The case is:
[ServiceContract] public interface IInfo { [DataMember] int Id{get;set;} } [DataContract] [KnownType(typeof(Legal))] public class Info { [DataMember] public int Id { get; set; } } [DataContract] public class Legal : Info { [DataMember] public string ManagerName { get; set; } } [ServiceContract] [ServiceKnownType(typeof(Legal))] public interface IMyService { [OperationContract] int DoWork(Info dto); } [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] public class MyService : IMyService { public int DoWork(Info dto) { string name; if (dto is Legal) name = (dto as Legal).ManagerName; return dto.Id; } }
Is it possible to know the dto as Legal type and have access to the child properties?
I want to store the dto and I don't want to have many services for each child of info.
Passing Generics to service doesn't work, wsdl error, Interface such as IInfo as input parameter doesn't work, casting error, Base class like Info doesn't work, child props are not accessible, stack overflow doesn't work, this is my 2nd time i post this prob but no answer!