Guest User

GeneratedCode

a guest
Oct 26th, 2012
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 7.34 KB | None | 0 0
  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.     {
  9.        
  10.         private bool _raisePropertyChangedEvents = true;
  11.        
  12.         private byte[] _rowVersion;
  13.        
  14.         private int _id = -1;
  15.        
  16.         private string _line1 = default(string);
  17.        
  18.         private string _line2 = default(string);
  19.        
  20.         private string _city = default(string);
  21.        
  22.         private string _zip = default(string);
  23.        
  24.         private string _country = default(string);
  25.        
  26.         private int _contactId = -1;
  27.        
  28.         [System.NonSerializedAttribute()]
  29.         private ContactManager.Contact _contact = null;
  30.        
  31.         private string _googleMapUrl = default(string);
  32.        
  33.         private string _liveMapUrl = default(string);
  34.        
  35.         [System.NonSerializedAttribute()]
  36.         private bool _isSerializing;
  37.        
  38.         [System.NonSerializedAttribute()]
  39.         private bool _isDeserializing;
  40.        
  41.        
  42.         public Address()
  43.         {
  44.             this._entityState = CodeFluent.Runtime.CodeFluentEntityState.Created;
  45.         }
  46.        
  47.         [System.ComponentModel.BrowsableAttribute(false)]
  48.         [System.Xml.Serialization.XmlIgnoreAttribute()]
  49.         public virtual bool RaisePropertyChangedEvents
  50.         {
  51.             get
  52.             {
  53.                 return this._raisePropertyChangedEvents;
  54.             }
  55.             set
  56.             {
  57.                 this._raisePropertyChangedEvents = value;
  58.             }
  59.         }
  60.        
  61.         [System.Runtime.Serialization.DataMemberAttribute()]
  62.         public virtual string EntityKey
  63.         {
  64.             get
  65.             {
  66.                 return this.Id.ToString();
  67.             }
  68.             set
  69.             {
  70.                 this.Id = ((int)(ConvertUtilities.ChangeType(value, typeof(int), -1)));
  71.             }
  72.         }
  73.  
  74.  
  75. [System.ComponentModel.DefaultValueAttribute(default(string))]
  76.         [System.Xml.Serialization.XmlElementAttribute(IsNullable=true, Type=typeof(string))]
  77.         [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=400)]
  78.         public string City
  79.         {
  80.             get
  81.             {
  82.                 return this._city;
  83.             }
  84.             set
  85.             {
  86.                 this._city = value;
  87.                 this.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Modified;
  88.                 this.OnPropertyChanged(new System.ComponentModel.PropertyChangedEventArgs("City"));
  89.             }
  90.         }
  91.  
  92. [System.Xml.Serialization.XmlIgnoreAttribute()]
  93.         public ContactManager.Contact Contact
  94.         {
  95.             get
  96.             {
  97.                 if ((this._contact == null))
  98.                 {
  99.                     this._contact = ContactManager.Contact.Load(this._contactId);
  100.                 }
  101.                 return this._contact;
  102.             }
  103.             set
  104.             {
  105.                 if ((value != null))
  106.                 {
  107.                     value.AddressId = this.Id;
  108.                 }
  109.                 this._contactId = -1;
  110.                 this._contact = value;
  111.                 this.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Modified;
  112.                 this.OnPropertyChanged(new System.ComponentModel.PropertyChangedEventArgs("Contact"));
  113.                 this.OnPropertyChanged(new System.ComponentModel.PropertyChangedEventArgs("ContactId"));
  114.             }
  115.         }
  116.  
  117. [System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Select, true)]
  118.         public static ContactManager.Address Load(int id)
  119.         {
  120.             if ((id == -1))
  121.             {
  122.                 return null;
  123.             }
  124.             ContactManager.Address address = new ContactManager.Address();
  125.             CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(ContactManager.Constants.ContactManagerStoreName).Persistence;
  126.             persistence.CreateStoredProcedureCommand(null, "Address", "Load");
  127.             persistence.AddParameter("@Id", id, ((int)(-1)));
  128.             System.Data.IDataReader reader = null;
  129.             try
  130.             {
  131.                 reader = persistence.ExecuteReader();
  132.                 if ((reader.Read() == true))
  133.                 {
  134.                     address.ReadRecord(reader, CodeFluent.Runtime.CodeFluentReloadOptions.Default);
  135.                     address.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged;
  136.                     return address;
  137.                 }
  138.             }
  139.             finally
  140.             {
  141.                 if ((reader != null))
  142.                 {
  143.                     reader.Dispose();
  144.                 }
  145.                 persistence.CompleteCommand();
  146.             }
  147.             return null;
  148.         }
  149.        
  150.  
  151. public string Trace()
  152.         {
  153.             System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
  154.             System.IO.StringWriter stringWriter = new System.IO.StringWriter(stringBuilder, System.Globalization.CultureInfo.CurrentCulture);
  155.             System.CodeDom.Compiler.IndentedTextWriter writer = new System.CodeDom.Compiler.IndentedTextWriter(stringWriter);
  156.             this.BaseTrace(writer);
  157.             writer.Flush();
  158.             ((System.IDisposable)(writer)).Dispose();
  159.             ((System.IDisposable)(stringWriter)).Dispose();
  160.             string sr = stringBuilder.ToString();
  161.             return sr;
  162.         }
  163.  
  164. [field:System.NonSerializedAttribute()]
  165.         public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
  166.  
  167. protected virtual void OnPropertyChanged(System.ComponentModel.PropertyChangedEventArgs e)
  168.         {
  169.             if ((this.RaisePropertyChangedEvents == false))
  170.             {
  171.                 return;
  172.             }
  173.             if ((this.PropertyChanged != null))
  174.             {
  175.                 this.PropertyChanged(this, e);
  176.             }
  177.         }
  178.  
  179. public virtual bool Equals(ContactManager.Address address)
  180.         {
  181.             if ((address == null))
  182.             {
  183.                 return false;
  184.             }
  185.             if ((this.Id == -1))
  186.             {
  187.                 return base.Equals(address);
  188.             }
  189.             return (this.Id.Equals(address.Id) == true);
  190.         }
  191.        
  192.         public override int GetHashCode()
  193.         {
  194.             return this._id;
  195.         }
  196.        
  197.         public override bool Equals(object obj)
  198.         {
  199.             ContactManager.Address address = null;
  200.                                                 address = obj as ContactManager.Address;
  201.             return this.Equals(address);
  202.         }
  203.  
  204. [...]
  205. }
Advertisement
Add Comment
Please, Sign In to add comment