Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [System.SerializableAttribute()]
- [System.ComponentModel.DataObjectAttribute()]
- [System.Diagnostics.DebuggerDisplayAttribute("EK={EntityKey}, Line1={Line1}")]
- [System.ComponentModel.TypeConverterAttribute(typeof(CodeFluent.Runtime.Design.NameTypeConverter))]
- [System.Runtime.Serialization.DataContractAttribute(Namespace="http://schemas.contactmanager.com")]
- [System.Runtime.Serialization.KnownTypeAttribute(typeof(CodeFluent.Runtime.CodeFluentRelationType))]
- 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>
- {
- private bool _raisePropertyChangedEvents = true;
- private byte[] _rowVersion;
- private int _id = -1;
- private string _line1 = default(string);
- private string _line2 = default(string);
- private string _city = default(string);
- private string _zip = default(string);
- private string _country = default(string);
- private int _contactId = -1;
- [System.NonSerializedAttribute()]
- private ContactManager.Contact _contact = null;
- private string _googleMapUrl = default(string);
- private string _liveMapUrl = default(string);
- [System.NonSerializedAttribute()]
- private bool _isSerializing;
- [System.NonSerializedAttribute()]
- private bool _isDeserializing;
- public Address()
- {
- this._entityState = CodeFluent.Runtime.CodeFluentEntityState.Created;
- }
- [System.ComponentModel.BrowsableAttribute(false)]
- [System.Xml.Serialization.XmlIgnoreAttribute()]
- public virtual bool RaisePropertyChangedEvents
- {
- get
- {
- return this._raisePropertyChangedEvents;
- }
- set
- {
- this._raisePropertyChangedEvents = value;
- }
- }
- [System.Runtime.Serialization.DataMemberAttribute()]
- public virtual string EntityKey
- {
- get
- {
- return this.Id.ToString();
- }
- set
- {
- this.Id = ((int)(ConvertUtilities.ChangeType(value, typeof(int), -1)));
- }
- }
- [System.ComponentModel.DefaultValueAttribute(default(string))]
- [System.Xml.Serialization.XmlElementAttribute(IsNullable=true, Type=typeof(string))]
- [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=400)]
- public string City
- {
- get
- {
- return this._city;
- }
- set
- {
- this._city = value;
- this.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Modified;
- this.OnPropertyChanged(new System.ComponentModel.PropertyChangedEventArgs("City"));
- }
- }
- [System.Xml.Serialization.XmlIgnoreAttribute()]
- public ContactManager.Contact Contact
- {
- get
- {
- if ((this._contact == null))
- {
- this._contact = ContactManager.Contact.Load(this._contactId);
- }
- return this._contact;
- }
- set
- {
- if ((value != null))
- {
- value.AddressId = this.Id;
- }
- this._contactId = -1;
- this._contact = value;
- this.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Modified;
- this.OnPropertyChanged(new System.ComponentModel.PropertyChangedEventArgs("Contact"));
- this.OnPropertyChanged(new System.ComponentModel.PropertyChangedEventArgs("ContactId"));
- }
- }
- [System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Select, true)]
- public static ContactManager.Address Load(int id)
- {
- if ((id == -1))
- {
- return null;
- }
- ContactManager.Address address = new ContactManager.Address();
- CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(ContactManager.Constants.ContactManagerStoreName).Persistence;
- persistence.CreateStoredProcedureCommand(null, "Address", "Load");
- persistence.AddParameter("@Id", id, ((int)(-1)));
- System.Data.IDataReader reader = null;
- try
- {
- reader = persistence.ExecuteReader();
- if ((reader.Read() == true))
- {
- address.ReadRecord(reader, CodeFluent.Runtime.CodeFluentReloadOptions.Default);
- address.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged;
- return address;
- }
- }
- finally
- {
- if ((reader != null))
- {
- reader.Dispose();
- }
- persistence.CompleteCommand();
- }
- return null;
- }
- public string Trace()
- {
- System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
- System.IO.StringWriter stringWriter = new System.IO.StringWriter(stringBuilder, System.Globalization.CultureInfo.CurrentCulture);
- System.CodeDom.Compiler.IndentedTextWriter writer = new System.CodeDom.Compiler.IndentedTextWriter(stringWriter);
- this.BaseTrace(writer);
- writer.Flush();
- ((System.IDisposable)(writer)).Dispose();
- ((System.IDisposable)(stringWriter)).Dispose();
- string sr = stringBuilder.ToString();
- return sr;
- }
- [field:System.NonSerializedAttribute()]
- public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
- protected virtual void OnPropertyChanged(System.ComponentModel.PropertyChangedEventArgs e)
- {
- if ((this.RaisePropertyChangedEvents == false))
- {
- return;
- }
- if ((this.PropertyChanged != null))
- {
- this.PropertyChanged(this, e);
- }
- }
- public virtual bool Equals(ContactManager.Address address)
- {
- if ((address == null))
- {
- return false;
- }
- if ((this.Id == -1))
- {
- return base.Equals(address);
- }
- return (this.Id.Equals(address.Id) == true);
- }
- public override int GetHashCode()
- {
- return this._id;
- }
- public override bool Equals(object obj)
- {
- ContactManager.Address address = null;
- address = obj as ContactManager.Address;
- return this.Equals(address);
- }
- [...]
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement