C# Class structure for WCF DataContract -
how implement following c# class structure used in wcf service? structure in document class created. it's person class can have multiple occurances i'm having problem with.
item - class
identifier - class (member of item)
- field1 (int)
- field2 (string)
details - class (member of item)
- detail1 (int)
- detail2 (string)
- ...
persons - class (member of item)
person - class (can have 1 200 occurances)
- info2 (string)
i have following far , not sure need complete:
[datacontract] public class item { public class identifier { [datamember] public int field1; [datamember] public string field2; } public class details { [datamember] public int detail1; [datamember] public string detail2; } public class persons { public class person { } } }
by nesting declaration of class within class there's no instance of created, somehow magically. declaring data wcf contract isn't anyhow different—except respective attribute decorations—from declaring other data structures. hence looking this:
[datacontract] public class identifier { … } [datacontract] public class details { … } [datacontract] public class person { … } [datacontract] public class item { [datamember] public identifier id { get; set; } [datamember] public details details { get; set; } [datamember] public list<person> persons { get; set; } }
Comments
Post a Comment