This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi, is something like this possible? Can I send model class to webservice and cast to Entity? I know I can't use unbound generic parameters in web method.
ASP.NET Webservice
using SomeModelClass; // model [WebMethod] public void AddEntity(Entity e) { var uow = setup context; using (var db = uow.CreateUnitOfWork()) { db.Add(e); db.SaveChanges(); } }
WinForms
using SomeModelClass; var l = new SomeModel {Parm1 = "some data"}; var db = new soap client; db.AddEntity(l);
|
|
|
Yes you could do this but you would also need to include [XmlInclude] attributes on your service method to detail each of the specific types you might be sending as the XmlSerializer needs specific typing information (WCF works the same way with its KnownType markup). e.g. [WebMethod] public void AddEntity(Entity e) |
|