/AUSRIS/AUSRIS.Data/AUSRIS.Data.Model/au_PmeMethod.cs
# · C# · 328 lines · 292 code · 28 blank · 8 comment · 54 complexity · ce5c509644cabe737d98069015e629db MD5 · raw file
- //------------------------------------------------------------------------------
- // <auto-generated>
- // This code was generated from a template.
- //
- // Changes to this file may cause incorrect behavior and will be lost if
- // the code is regenerated.
- // </auto-generated>
- //------------------------------------------------------------------------------
-
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.Collections.Specialized;
- using System.ComponentModel;
- using System.Globalization;
- using System.Runtime.Serialization;
-
- namespace AUSRIS.Data.Model
- {
- [DataContract(IsReference = true)]
- [KnownType(typeof(au_PersonPmeHistory))]
- public partial class au_PmeMethod: IObjectWithChangeTracker, INotifyPropertyChanged
- {
- #region Primitive Properties
-
- [DataMember]
- public int Id
- {
- get { return _id; }
- set
- {
- if (_id != value)
- {
- if (ChangeTracker.ChangeTrackingEnabled && ChangeTracker.State != ObjectState.Added)
- {
- 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.");
- }
- _id = value;
- OnPropertyChanged("Id");
- }
- }
- }
- private int _id;
-
- [DataMember]
- public System.DateTime LastUpdated
- {
- get { return _lastUpdated; }
- set
- {
- if (_lastUpdated != value)
- {
- _lastUpdated = value;
- OnPropertyChanged("LastUpdated");
- }
- }
- }
- private System.DateTime _lastUpdated;
-
- [DataMember]
- public string AddedBy
- {
- get { return _addedBy; }
- set
- {
- if (_addedBy != value)
- {
- _addedBy = value;
- OnPropertyChanged("AddedBy");
- }
- }
- }
- private string _addedBy;
-
- [DataMember]
- public System.DateTime AddedDate
- {
- get { return _addedDate; }
- set
- {
- if (_addedDate != value)
- {
- _addedDate = value;
- OnPropertyChanged("AddedDate");
- }
- }
- }
- private System.DateTime _addedDate;
-
- [DataMember]
- public string UpdatedBy
- {
- get { return _updatedBy; }
- set
- {
- if (_updatedBy != value)
- {
- _updatedBy = value;
- OnPropertyChanged("UpdatedBy");
- }
- }
- }
- private string _updatedBy;
-
- [DataMember]
- public Nullable<System.DateTime> UpdatedDate
- {
- get { return _updatedDate; }
- set
- {
- if (_updatedDate != value)
- {
- _updatedDate = value;
- OnPropertyChanged("UpdatedDate");
- }
- }
- }
- private Nullable<System.DateTime> _updatedDate;
-
- [DataMember]
- public bool IsViewable
- {
- get { return _isViewable; }
- set
- {
- if (_isViewable != value)
- {
- _isViewable = value;
- OnPropertyChanged("IsViewable");
- }
- }
- }
- private bool _isViewable;
-
- [DataMember]
- public int ViewOrder
- {
- get { return _viewOrder; }
- set
- {
- if (_viewOrder != value)
- {
- _viewOrder = value;
- OnPropertyChanged("ViewOrder");
- }
- }
- }
- private int _viewOrder;
-
- [DataMember]
- public string Description
- {
- get { return _description; }
- set
- {
- if (_description != value)
- {
- _description = value;
- OnPropertyChanged("Description");
- }
- }
- }
- private string _description;
-
- #endregion
- #region Navigation Properties
-
- [DataMember]
- public TrackableCollection<au_PersonPmeHistory> au_PersonPmeHistory
- {
- get
- {
- if (_au_PersonPmeHistory == null)
- {
- _au_PersonPmeHistory = new TrackableCollection<au_PersonPmeHistory>();
- _au_PersonPmeHistory.CollectionChanged += Fixupau_PersonPmeHistory;
- }
- return _au_PersonPmeHistory;
- }
- set
- {
- if (!ReferenceEquals(_au_PersonPmeHistory, value))
- {
- if (ChangeTracker.ChangeTrackingEnabled)
- {
- throw new InvalidOperationException("Cannot set the FixupChangeTrackingCollection when ChangeTracking is enabled");
- }
- if (_au_PersonPmeHistory != null)
- {
- _au_PersonPmeHistory.CollectionChanged -= Fixupau_PersonPmeHistory;
- }
- _au_PersonPmeHistory = value;
- if (_au_PersonPmeHistory != null)
- {
- _au_PersonPmeHistory.CollectionChanged += Fixupau_PersonPmeHistory;
- }
- OnNavigationPropertyChanged("au_PersonPmeHistory");
- }
- }
- }
- private TrackableCollection<au_PersonPmeHistory> _au_PersonPmeHistory;
-
- #endregion
- #region ChangeTracking
-
- protected virtual void OnPropertyChanged(String propertyName)
- {
- if (ChangeTracker.State != ObjectState.Added && ChangeTracker.State != ObjectState.Deleted)
- {
- ChangeTracker.State = ObjectState.Modified;
- }
- if (_propertyChanged != null)
- {
- _propertyChanged(this, new PropertyChangedEventArgs(propertyName));
- }
- }
-
- protected virtual void OnNavigationPropertyChanged(String propertyName)
- {
- if (_propertyChanged != null)
- {
- _propertyChanged(this, new PropertyChangedEventArgs(propertyName));
- }
- }
-
- event PropertyChangedEventHandler INotifyPropertyChanged.PropertyChanged{ add { _propertyChanged += value; } remove { _propertyChanged -= value; } }
- private event PropertyChangedEventHandler _propertyChanged;
- private ObjectChangeTracker _changeTracker;
-
- [DataMember]
- public ObjectChangeTracker ChangeTracker
- {
- get
- {
- if (_changeTracker == null)
- {
- _changeTracker = new ObjectChangeTracker();
- _changeTracker.ObjectStateChanging += HandleObjectStateChanging;
- }
- return _changeTracker;
- }
- set
- {
- if(_changeTracker != null)
- {
- _changeTracker.ObjectStateChanging -= HandleObjectStateChanging;
- }
- _changeTracker = value;
- if(_changeTracker != null)
- {
- _changeTracker.ObjectStateChanging += HandleObjectStateChanging;
- }
- }
- }
-
- private void HandleObjectStateChanging(object sender, ObjectStateChangingEventArgs e)
- {
- if (e.NewState == ObjectState.Deleted)
- {
- ClearNavigationProperties();
- }
- }
-
- protected bool IsDeserializing { get; private set; }
-
- [OnDeserializing]
- public void OnDeserializingMethod(StreamingContext context)
- {
- IsDeserializing = true;
- }
-
- [OnDeserialized]
- public void OnDeserializedMethod(StreamingContext context)
- {
- IsDeserializing = false;
- ChangeTracker.ChangeTrackingEnabled = true;
- }
-
- protected virtual void ClearNavigationProperties()
- {
- au_PersonPmeHistory.Clear();
- }
-
- #endregion
- #region Association Fixup
-
- private void Fixupau_PersonPmeHistory(object sender, NotifyCollectionChangedEventArgs e)
- {
- if (IsDeserializing)
- {
- return;
- }
-
- if (e.NewItems != null)
- {
- foreach (au_PersonPmeHistory item in e.NewItems)
- {
- item.au_PmeMethod = this;
- if (ChangeTracker.ChangeTrackingEnabled)
- {
- if (!item.ChangeTracker.ChangeTrackingEnabled)
- {
- item.StartTracking();
- }
- ChangeTracker.RecordAdditionToCollectionProperties("au_PersonPmeHistory", item);
- }
- }
- }
-
- if (e.OldItems != null)
- {
- foreach (au_PersonPmeHistory item in e.OldItems)
- {
- if (ReferenceEquals(item.au_PmeMethod, this))
- {
- item.au_PmeMethod = null;
- }
- if (ChangeTracker.ChangeTrackingEnabled)
- {
- ChangeTracker.RecordRemovalFromCollectionProperties("au_PersonPmeHistory", item);
- }
- }
- }
- }
-
- #endregion
- }
- }