PageRenderTime 108ms CodeModel.GetById 10ms RepoModel.GetById 1ms app.codeStats 0ms

/AUSRIS/AUSRIS.Data/AUSRIS.Data.Model/au_EducationType.cs

#
C# | 328 lines | 292 code | 28 blank | 8 comment | 54 complexity | f0f7c355f4c7f99705c57de67febddd1 MD5 | raw file
  1. //------------------------------------------------------------------------------
  2. // <auto-generated>
  3. // This code was generated from a template.
  4. //
  5. // Changes to this file may cause incorrect behavior and will be lost if
  6. // the code is regenerated.
  7. // </auto-generated>
  8. //------------------------------------------------------------------------------
  9. using System;
  10. using System.Collections.Generic;
  11. using System.Collections.ObjectModel;
  12. using System.Collections.Specialized;
  13. using System.ComponentModel;
  14. using System.Globalization;
  15. using System.Runtime.Serialization;
  16. namespace AUSRIS.Data.Model
  17. {
  18. [DataContract(IsReference = true)]
  19. [KnownType(typeof(au_PersonEducationHistory))]
  20. public partial class au_EducationType: IObjectWithChangeTracker, INotifyPropertyChanged
  21. {
  22. #region Primitive Properties
  23. [DataMember]
  24. public int Id
  25. {
  26. get { return _id; }
  27. set
  28. {
  29. if (_id != value)
  30. {
  31. if (ChangeTracker.ChangeTrackingEnabled && ChangeTracker.State != ObjectState.Added)
  32. {
  33. throw new InvalidOperationException("The property 'Id' is part of the object's key and cannot be changed. Changes to key properties can only be made when the object is not being tracked or is in the Added state.");
  34. }
  35. _id = value;
  36. OnPropertyChanged("Id");
  37. }
  38. }
  39. }
  40. private int _id;
  41. [DataMember]
  42. public System.DateTime LastUpdated
  43. {
  44. get { return _lastUpdated; }
  45. set
  46. {
  47. if (_lastUpdated != value)
  48. {
  49. _lastUpdated = value;
  50. OnPropertyChanged("LastUpdated");
  51. }
  52. }
  53. }
  54. private System.DateTime _lastUpdated;
  55. [DataMember]
  56. public string AddedBy
  57. {
  58. get { return _addedBy; }
  59. set
  60. {
  61. if (_addedBy != value)
  62. {
  63. _addedBy = value;
  64. OnPropertyChanged("AddedBy");
  65. }
  66. }
  67. }
  68. private string _addedBy;
  69. [DataMember]
  70. public System.DateTime AddedDate
  71. {
  72. get { return _addedDate; }
  73. set
  74. {
  75. if (_addedDate != value)
  76. {
  77. _addedDate = value;
  78. OnPropertyChanged("AddedDate");
  79. }
  80. }
  81. }
  82. private System.DateTime _addedDate;
  83. [DataMember]
  84. public string UpdatedBy
  85. {
  86. get { return _updatedBy; }
  87. set
  88. {
  89. if (_updatedBy != value)
  90. {
  91. _updatedBy = value;
  92. OnPropertyChanged("UpdatedBy");
  93. }
  94. }
  95. }
  96. private string _updatedBy;
  97. [DataMember]
  98. public Nullable<System.DateTime> UpdatedDate
  99. {
  100. get { return _updatedDate; }
  101. set
  102. {
  103. if (_updatedDate != value)
  104. {
  105. _updatedDate = value;
  106. OnPropertyChanged("UpdatedDate");
  107. }
  108. }
  109. }
  110. private Nullable<System.DateTime> _updatedDate;
  111. [DataMember]
  112. public bool IsViewable
  113. {
  114. get { return _isViewable; }
  115. set
  116. {
  117. if (_isViewable != value)
  118. {
  119. _isViewable = value;
  120. OnPropertyChanged("IsViewable");
  121. }
  122. }
  123. }
  124. private bool _isViewable;
  125. [DataMember]
  126. public int ViewOrder
  127. {
  128. get { return _viewOrder; }
  129. set
  130. {
  131. if (_viewOrder != value)
  132. {
  133. _viewOrder = value;
  134. OnPropertyChanged("ViewOrder");
  135. }
  136. }
  137. }
  138. private int _viewOrder;
  139. [DataMember]
  140. public string Description
  141. {
  142. get { return _description; }
  143. set
  144. {
  145. if (_description != value)
  146. {
  147. _description = value;
  148. OnPropertyChanged("Description");
  149. }
  150. }
  151. }
  152. private string _description;
  153. #endregion
  154. #region Navigation Properties
  155. [DataMember]
  156. public TrackableCollection<au_PersonEducationHistory> au_PersonEducationHistory
  157. {
  158. get
  159. {
  160. if (_au_PersonEducationHistory == null)
  161. {
  162. _au_PersonEducationHistory = new TrackableCollection<au_PersonEducationHistory>();
  163. _au_PersonEducationHistory.CollectionChanged += Fixupau_PersonEducationHistory;
  164. }
  165. return _au_PersonEducationHistory;
  166. }
  167. set
  168. {
  169. if (!ReferenceEquals(_au_PersonEducationHistory, value))
  170. {
  171. if (ChangeTracker.ChangeTrackingEnabled)
  172. {
  173. throw new InvalidOperationException("Cannot set the FixupChangeTrackingCollection when ChangeTracking is enabled");
  174. }
  175. if (_au_PersonEducationHistory != null)
  176. {
  177. _au_PersonEducationHistory.CollectionChanged -= Fixupau_PersonEducationHistory;
  178. }
  179. _au_PersonEducationHistory = value;
  180. if (_au_PersonEducationHistory != null)
  181. {
  182. _au_PersonEducationHistory.CollectionChanged += Fixupau_PersonEducationHistory;
  183. }
  184. OnNavigationPropertyChanged("au_PersonEducationHistory");
  185. }
  186. }
  187. }
  188. private TrackableCollection<au_PersonEducationHistory> _au_PersonEducationHistory;
  189. #endregion
  190. #region ChangeTracking
  191. protected virtual void OnPropertyChanged(String propertyName)
  192. {
  193. if (ChangeTracker.State != ObjectState.Added && ChangeTracker.State != ObjectState.Deleted)
  194. {
  195. ChangeTracker.State = ObjectState.Modified;
  196. }
  197. if (_propertyChanged != null)
  198. {
  199. _propertyChanged(this, new PropertyChangedEventArgs(propertyName));
  200. }
  201. }
  202. protected virtual void OnNavigationPropertyChanged(String propertyName)
  203. {
  204. if (_propertyChanged != null)
  205. {
  206. _propertyChanged(this, new PropertyChangedEventArgs(propertyName));
  207. }
  208. }
  209. event PropertyChangedEventHandler INotifyPropertyChanged.PropertyChanged{ add { _propertyChanged += value; } remove { _propertyChanged -= value; } }
  210. private event PropertyChangedEventHandler _propertyChanged;
  211. private ObjectChangeTracker _changeTracker;
  212. [DataMember]
  213. public ObjectChangeTracker ChangeTracker
  214. {
  215. get
  216. {
  217. if (_changeTracker == null)
  218. {
  219. _changeTracker = new ObjectChangeTracker();
  220. _changeTracker.ObjectStateChanging += HandleObjectStateChanging;
  221. }
  222. return _changeTracker;
  223. }
  224. set
  225. {
  226. if(_changeTracker != null)
  227. {
  228. _changeTracker.ObjectStateChanging -= HandleObjectStateChanging;
  229. }
  230. _changeTracker = value;
  231. if(_changeTracker != null)
  232. {
  233. _changeTracker.ObjectStateChanging += HandleObjectStateChanging;
  234. }
  235. }
  236. }
  237. private void HandleObjectStateChanging(object sender, ObjectStateChangingEventArgs e)
  238. {
  239. if (e.NewState == ObjectState.Deleted)
  240. {
  241. ClearNavigationProperties();
  242. }
  243. }
  244. protected bool IsDeserializing { get; private set; }
  245. [OnDeserializing]
  246. public void OnDeserializingMethod(StreamingContext context)
  247. {
  248. IsDeserializing = true;
  249. }
  250. [OnDeserialized]
  251. public void OnDeserializedMethod(StreamingContext context)
  252. {
  253. IsDeserializing = false;
  254. ChangeTracker.ChangeTrackingEnabled = true;
  255. }
  256. protected virtual void ClearNavigationProperties()
  257. {
  258. au_PersonEducationHistory.Clear();
  259. }
  260. #endregion
  261. #region Association Fixup
  262. private void Fixupau_PersonEducationHistory(object sender, NotifyCollectionChangedEventArgs e)
  263. {
  264. if (IsDeserializing)
  265. {
  266. return;
  267. }
  268. if (e.NewItems != null)
  269. {
  270. foreach (au_PersonEducationHistory item in e.NewItems)
  271. {
  272. item.au_EducationType = this;
  273. if (ChangeTracker.ChangeTrackingEnabled)
  274. {
  275. if (!item.ChangeTracker.ChangeTrackingEnabled)
  276. {
  277. item.StartTracking();
  278. }
  279. ChangeTracker.RecordAdditionToCollectionProperties("au_PersonEducationHistory", item);
  280. }
  281. }
  282. }
  283. if (e.OldItems != null)
  284. {
  285. foreach (au_PersonEducationHistory item in e.OldItems)
  286. {
  287. if (ReferenceEquals(item.au_EducationType, this))
  288. {
  289. item.au_EducationType = null;
  290. }
  291. if (ChangeTracker.ChangeTrackingEnabled)
  292. {
  293. ChangeTracker.RecordRemovalFromCollectionProperties("au_PersonEducationHistory", item);
  294. }
  295. }
  296. }
  297. }
  298. #endregion
  299. }
  300. }