View difference between Paste ID: 6gLzetKX and SCCZRgGr
SHOW: | | - or go back to the newest paste.
1
[System.SerializableAttribute()]
2
    [System.ComponentModel.DataObjectAttribute()]
3
    [System.Diagnostics.DebuggerDisplayAttribute("EK={EntityKey}, Line1={Line1}")]
4
    [System.ComponentModel.TypeConverterAttribute(typeof(CodeFluent.Runtime.Design.NameTypeConverter))]
5
    [System.Runtime.Serialization.DataContractAttribute(Namespace="http://schemas.contactmanager.com")]
6
    [System.Runtime.Serialization.KnownTypeAttribute(typeof(CodeFluent.Runtime.CodeFluentRelationType))]
7
    public partial class Address : System.ICloneable, System.IComparable, System.IComparable<ContactManager.Address>, CodeFluent.Runtime.ICodeFluentEntity, System.ComponentModel.IDataErrorInfo, CodeFluent.Runtime.ICodeFluentMemberValidator, CodeFluent.Runtime.ICodeFluentSummaryValidator, System.IEquatable<ContactManager.Address>
8-
    {
8+
    {        
9
        private bool _raisePropertyChangedEvents = true;
10
        
11
        private byte[] _rowVersion;
12
        
13
        private int _id = -1;
14
        
15
        private string _line1 = default(string);
16
        
17
        private string _line2 = default(string);
18
        
19
        private string _city = default(string);
20
        
21
        private string _zip = default(string);
22
        
23
        private string _country = default(string);
24
        
25
        private int _contactId = -1;
26
        
27
        [System.NonSerializedAttribute()]
28
        private ContactManager.Contact _contact = null;
29
        
30
        private string _googleMapUrl = default(string);
31
        
32
        private string _liveMapUrl = default(string);
33
        
34
        [System.NonSerializedAttribute()]
35
        private bool _isSerializing;
36
        
37
        [System.NonSerializedAttribute()]
38
        private bool _isDeserializing;
39
        
40
        
41
        public Address()
42
        {
43
            this._entityState = CodeFluent.Runtime.CodeFluentEntityState.Created;
44
        }
45
        
46
        [System.ComponentModel.BrowsableAttribute(false)]
47
        [System.Xml.Serialization.XmlIgnoreAttribute()]
48
        public virtual bool RaisePropertyChangedEvents
49
        {
50
            get
51
            {
52
                return this._raisePropertyChangedEvents;
53
            }
54
            set
55
            {
56
                this._raisePropertyChangedEvents = value;
57
            }
58
        }
59
        
60
        [System.Runtime.Serialization.DataMemberAttribute()]
61
        public virtual string EntityKey
62
        {
63
            get
64
            {
65
                return this.Id.ToString();
66
            }
67
            set
68
            {
69
                this.Id = ((int)(ConvertUtilities.ChangeType(value, typeof(int), -1)));
70
            }
71
        }
72
73
[System.ComponentModel.DefaultValueAttribute(default(string))]
74
        [System.Xml.Serialization.XmlElementAttribute(IsNullable=true, Type=typeof(string))]
75
        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=400)]
76
        public string City
77
        {
78
            get
79
            {
80
                return this._city;
81
            }
82
            set
83
            {
84
                this._city = value;
85
                this.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Modified;
86
                this.OnPropertyChanged(new System.ComponentModel.PropertyChangedEventArgs("City"));
87
            }
88
        }
89
90
[System.Xml.Serialization.XmlIgnoreAttribute()]
91
        public ContactManager.Contact Contact
92
        {
93
            get
94
            {
95
                if ((this._contact == null))
96
                {
97
                    this._contact = ContactManager.Contact.Load(this._contactId);
98
                }
99
                return this._contact;
100
            }
101
            set
102
            {
103
                if ((value != null))
104
                {
105
                    value.AddressId = this.Id;
106
                }
107
                this._contactId = -1;
108
                this._contact = value;
109
                this.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Modified;
110
                this.OnPropertyChanged(new System.ComponentModel.PropertyChangedEventArgs("Contact"));
111
                this.OnPropertyChanged(new System.ComponentModel.PropertyChangedEventArgs("ContactId"));
112
            }
113
        }
114
115
[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Select, true)]
116
        public static ContactManager.Address Load(int id)
117
        {
118
            if ((id == -1))
119
            {
120
                return null;
121
            }
122
            ContactManager.Address address = new ContactManager.Address();
123
            CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(ContactManager.Constants.ContactManagerStoreName).Persistence;
124
            persistence.CreateStoredProcedureCommand(null, "Address", "Load");
125
            persistence.AddParameter("@Id", id, ((int)(-1)));
126
            System.Data.IDataReader reader = null;
127
            try
128
            {
129
                reader = persistence.ExecuteReader();
130
                if ((reader.Read() == true))
131
                {
132
                    address.ReadRecord(reader, CodeFluent.Runtime.CodeFluentReloadOptions.Default);
133
                    address.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged;
134
                    return address;
135
                }
136
            }
137
            finally
138
            {
139
                if ((reader != null))
140
                {
141
                    reader.Dispose();
142
                }
143
                persistence.CompleteCommand();
144
            }
145
            return null;
146
        }
147
        
148
public string Trace()
149
        {
150
            System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
151
            System.IO.StringWriter stringWriter = new System.IO.StringWriter(stringBuilder, System.Globalization.CultureInfo.CurrentCulture);
152
            System.CodeDom.Compiler.IndentedTextWriter writer = new System.CodeDom.Compiler.IndentedTextWriter(stringWriter);
153
            this.BaseTrace(writer);
154
            writer.Flush();
155
            ((System.IDisposable)(writer)).Dispose();
156
            ((System.IDisposable)(stringWriter)).Dispose();
157
            string sr = stringBuilder.ToString();
158
            return sr;
159
        }
160
161
[field:System.NonSerializedAttribute()]
162
        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
163
164
protected virtual void OnPropertyChanged(System.ComponentModel.PropertyChangedEventArgs e)
165
        {
166
            if ((this.RaisePropertyChangedEvents == false))
167
            {
168
                return;
169
            }
170
            if ((this.PropertyChanged != null))
171
            {
172
                this.PropertyChanged(this, e);
173
            }
174
        }
175
176
public virtual bool Equals(ContactManager.Address address)
177
        {
178
            if ((address == null))
179
            {
180
                return false;
181
            }
182
            if ((this.Id == -1))
183
            {
184
                return base.Equals(address);
185
            }
186
            return (this.Id.Equals(address.Id) == true);
187
        }
188
        
189
        public override int GetHashCode()
190
        {
191
            return this._id;
192
        }
193
        
194
        public override bool Equals(object obj)
195
        {
196
            ContactManager.Address address = null;
197
                                                address = obj as ContactManager.Address;
198
            return this.Equals(address);
199
        }
200
201
[...]
202
}