patrick31415 / protobuf-net

Automatically exported from code.google.com/p/protobuf-net
Other
0 stars 0 forks source link

DataMember(Order=0 not supported #336

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
from: jezza at pobox.com
==============
1. Do not use ProtoContract or ProtoMember attributes on data contract
2. Use DataContract and DataMember with a single property where DataMember has 
Order=0, IsRequired=true for that property
3. Use ProtoBehaviorExtension as the behavior extension for the endpoint - i.e. 
no code changes to support ProtoBuf at all, purely configuration based

You will find that the data contract is not populated between request / 
response.  It works fine if I set Order=1, but Order=0 is perfectly valid and 
quite standard practice for the first member.  To test, I used the following 
(data contracts and service contract are in a separate DLL shared by both 
client and server):

[DataContract]
    public class CalcType
    {
        [DataMember(Order = 0, IsRequired = true)]
        public virtual int Number { get; set; }
    }

[ServiceContract]
    public interface ICalculator
    {
        [OperationContract]
        CalcType Calculate(CalcType type1, CalcType type2);
    }

Version is 2.0.0.480

OS is Windows 7 Enterprise SP1 (64-bit)

Original issue reported on code.google.com by jpe...@gmail.com on 25 Oct 2012 at 1:13

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I'm in the same situation and I can't change the Order info.

Original comment by patrick....@gmail.com on 31 Oct 2012 at 9:21