//------------------------------------------------------------------------------ // // This code was generated from a template. // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // //------------------------------------------------------------------------------ using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Collections.Specialized; namespace WNS.Entities { public partial class WebMapService { #region Primitive Properties public virtual int Id { get; set; } public virtual string Name { get; set; } public virtual string Title { get; set; } public virtual string Abstract { get; set; } public virtual string OnlineResource { get; set; } public virtual string URL { get; set; } #endregion #region Navigation Properties public virtual Organization Organization { get { return _organization; } set { if (!ReferenceEquals(_organization, value)) { var previousValue = _organization; _organization = value; FixupOrganization(previousValue); } } } private Organization _organization; public virtual ICollection KeywordList { get { if (_keywordList == null) { var newCollection = new FixupCollection(); newCollection.CollectionChanged += FixupKeywordList; _keywordList = newCollection; } return _keywordList; } set { if (!ReferenceEquals(_keywordList, value)) { var previousValue = _keywordList as FixupCollection; if (previousValue != null) { previousValue.CollectionChanged -= FixupKeywordList; } _keywordList = value; var newValue = value as FixupCollection; if (newValue != null) { newValue.CollectionChanged += FixupKeywordList; } } } } private ICollection _keywordList; #endregion #region Association Fixup private void FixupOrganization(Organization previousValue) { if (previousValue != null && ReferenceEquals(previousValue.WebMapService, this)) { previousValue.WebMapService = null; } if (Organization != null) { Organization.WebMapService = this; } } private void FixupKeywordList(object sender, NotifyCollectionChangedEventArgs e) { if (e.NewItems != null) { foreach (KeywordList item in e.NewItems) { item.WebMapService = this; } } if (e.OldItems != null) { foreach (KeywordList item in e.OldItems) { if (ReferenceEquals(item.WebMapService, this)) { item.WebMapService = null; } } } } #endregion } }