Armen Khachatryan
Armen Khachatryan

Reputation: 839

WCF known types, not works

[ServiceContract]
[ServiceKnownType(typeof(DBReq))]
public interface IDAService
{


[DataContract]
[KnownType(typeof(IDataParameterCollection))]
public class DBReq : DBAccess
{

    [DataMember]
    public IDataParameterCollection DataParams
    {
    ...

Why does DataParams deserialize to type of Object on my client side?

Upvotes: 0

Views: 878

Answers (1)

tom redfern
tom redfern

Reputation: 31750

Your [KnownType(typeof(IDataParameterCollection))] is not correct. You should pass the implementing types to the KnownType attribute.

For example

public class MyType : IDataParameterCollection {...}

[DataContract]
[KnownType(typeof(MyType))]
public class DBReq : DBAccess
{

    [DataMember]
    public IDataParameterCollection DataParams
    {
    ...

Upvotes: 1

Related Questions