1: namespace Domain
2: {
3:
4: public class Customer
5: {
6: public Customer()
7: {
8: Products = new ProductCollection();
9: ContactHistory = new ContactHistory();
10: }
11:
12: public string Firstname { get; set; }
13: public string Surname { get; set; }
14: public DateTime DateOfBirth { get; set; }
15: public Address Address { get; set; }
16: public string EmailAddress { get; set;}
17:
18: public ProductCollection Products { get; private set; }
19:
20: // extra stuff on customer that you don't want third parties to provide
21: public ContactHistory ContactHistory { get; private set; }
22: // .....
23: }
24:
25: public class ContactHistory
26: {
27: }
28:
29: public class Address
30: {
31: public string HouseName {get; set;}
32: public string Postcode { get; set; }
33: }
34:
35:
36: public class ProductCollection : List<Product>
37: { }
38:
39: public class Product
40: {
41: public ProductType ProductType { get; set; }
42: }
43:
44: public class ProductType
45: {
46: public string Name { get; set; }
47: }
48: }
49:
50: namespace ServiceContract
51: {
52: [DataContract]
53: public class Customer
54: {
55: public Customer()
56: {
57: InterestedIn = new List<Product>();
58: }
59:
60: [DataMember]
61: public string Firstname { get; set; }
62: [DataMember]
63: public string Surname { get; set; }
64: [DataMember]
65: public DateTime DateOfBirth { get; set; }
66: [DataMember]
67: public Address Address { get; set; }
68: [DataMember]
69: public string EmailAddress { get; set; }
70: [DataMember]
71: public List<Product> InterestedIn { get; set; }
72: }
73:
74: [DataContract]
75: public class Product
76: {
77: [DataMember]
78: public string Name { get; set; }
79: }
80:
81: [DataContract]
82: public class Address
83: {
84: [DataMember]
85: public string HouseName { get; set; }
86: [DataMember]
87: public string Postcode { get; set; }
88: }
89: }