I'm under MVC 3, writing some classes used into a web service and they're also used in the app as entity. All is ok, but when the framework will generate the entities into the database, all SoapHeader attributes are also stored as table fields, ie:
- EncodedMustUnderstand
- EncodedMustUnderstand12
- MustUnderstand
- Actor
- ...
Of course this happen because the base class of MyEntityClass is System.Web.Services.Protocols.SoapHeader.
My question is: how can I avoid the creation of soap header attributes into the db without doing manually (like NotMapped attributes)?
Here is my code
// MyEntityClass.cs
public class MyEntityClass : System.Web.Services.Protocols.SoapHeader
{
// Attributes...
}
// MyService.asmx.cs
public class MyService : System.Web.Services.WebService
{
public MyEntityClass myClass; // Used as header from the client
[WebMethod]
[System.Web.Services.Protocols.SoapHeader("myClass")]
public string Hello()
{
}
}
Thanks guys!