views:

52

answers:

1

Hello. I try use WCF with protobuf-net r.282

Ok. I mark my contracts with ProtoBehavior attribute

    [OperationContract,ProtoBehavior]
    [FaultContract(typeof(ServiceFaultException))]
    Dictionary<ActivityCategoryDTO, SalesTemplateDTO> GetSalesTemplates();

    [OperationContract, ProtoBehavior]
    [FaultContract(typeof(ServiceFaultException))]
    List<ActivityCategoryDTO> GetActivities();

Next, - DTO:

    [DataContract]
    [Serializable]
    [ProtoContract]
    public class ActivityCategoryDTO
    {
        [DataMember]
        [ProtoMember(1)]
        public int Id { get; set; }
        [DataMember]
        [ProtoMember(2)]
        public string Guid { get; set; }
        [DataMember]
        [ProtoMember(3)]
        public string Name { get; set; }
    }

I try consume this servise from client. When I call GetSalesTemplates - all is OK. I've got successful deserialized dictionary, but when I call GetActivities I get null at client. Through fiddler I see that, data is transmitting succesfully, so I think it's deserializer problem.

What's wrong? How can I get List at Client?

EDIT

It seems that I have problems with all Lists :)

[DataContract]
[Serializable]
[ProtoContract]
public class SalesTemplateDTO
{
    [ProtoMember(1)]
    [DataMember]
    public string Name { get; set; }
    [ProtoMember(2)]
    public List<FieldTemplateDTO> Fields;
}

It comes to client just with Name, List of Fields is null again. Though all data is transmitted too.

+1  A: 

I don't know off the top of my head; I can investigate, but not right at this moment. As a pragmatic workaround (until I can find why), perhaps return something like a ActivityResult class that contains a List<ActivityCategoryDTO> as a member?

Marc Gravell