R
Ryan Liu
Hi,
I know this is basic OO concept , and not a problem in local calls.
I know The base type can specify the derived class as a known type using
the KnownTypeAttribute.
What about the opposite?
I want to use a derived class instance as parameter to a WCF service method,
and all properties I need is really in base class, so I just want to use it
as base class, but I get an error:
"....is not expected. Add any types not known statically to the list of
known types - for example, by using the KnownTypeAttribute attribute or by
adding them to the list of known types passed to DataContractSerializer
....."
[KnownType(typeof(MyBaseClass))]
[DataContract]
public class MyChildClass :MyBaseClass
{
public bool LocalFlag {get; set;}
}
Thanks a lot!
Ryan
I know this is basic OO concept , and not a problem in local calls.
I know The base type can specify the derived class as a known type using
the KnownTypeAttribute.
What about the opposite?
I want to use a derived class instance as parameter to a WCF service method,
and all properties I need is really in base class, so I just want to use it
as base class, but I get an error:
"....is not expected. Add any types not known statically to the list of
known types - for example, by using the KnownTypeAttribute attribute or by
adding them to the list of known types passed to DataContractSerializer
....."
[KnownType(typeof(MyBaseClass))]
[DataContract]
public class MyChildClass :MyBaseClass
{
public bool LocalFlag {get; set;}
}
Thanks a lot!
Ryan