/// <summary> setups the sync logic for member _salesPerson</summary> /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param> private void SetupSyncSalesPerson(IEntity relatedEntity) { if (_salesPerson != relatedEntity) { DesetupSyncSalesPerson(true, true); _salesPerson = (SalesPersonEntity)relatedEntity; base.PerformSetupSyncRelatedEntity(_salesPerson, new PropertyChangedEventHandler(OnSalesPersonPropertyChanged), "SalesPerson", SalesPersonQuotaHistoryEntity.Relations.SalesPersonEntityUsingSalesPersonID, true, ref _alreadyFetchedSalesPerson, new string[] { }); } }
/// <summary> Initializes the class members</summary> private void InitClassMembers() { _salesPerson = null; _salesPersonReturnsNewIfNotFound = true; _alwaysFetchSalesPerson = false; _alreadyFetchedSalesPerson = false; PerformDependencyInjection(); // __LLBLGENPRO_USER_CODE_REGION_START InitClassMembers // __LLBLGENPRO_USER_CODE_REGION_END OnInitClassMembersComplete(); }
/// <summary>Protected CTor for deserialization</summary> /// <param name="info"></param> /// <param name="context"></param> protected SalesPersonQuotaHistoryEntityBase(SerializationInfo info, StreamingContext context) : base(info, context) { _salesPerson = (SalesPersonEntity)info.GetValue("_salesPerson", typeof(SalesPersonEntity)); if (_salesPerson != null) { _salesPerson.AfterSave += new EventHandler(OnEntityAfterSave); } _salesPersonReturnsNewIfNotFound = info.GetBoolean("_salesPersonReturnsNewIfNotFound"); _alwaysFetchSalesPerson = info.GetBoolean("_alwaysFetchSalesPerson"); _alreadyFetchedSalesPerson = info.GetBoolean("_alreadyFetchedSalesPerson"); base.FixupDeserialization(FieldInfoProviderSingleton.GetInstance(), PersistenceInfoProviderSingleton.GetInstance()); // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor // __LLBLGENPRO_USER_CODE_REGION_END }
/// <summary> Retrieves the related entity of type 'SalesPersonEntity', using a relation of type 'n:1'</summary> /// <param name="forceFetch">if true, it will discard any changes currently in the currently loaded related entity and will refetch the entity from the persistent storage</param> /// <returns>A fetched entity of type 'SalesPersonEntity' which is related to this entity.</returns> public virtual SalesPersonEntity GetSingleSalesPerson(bool forceFetch) { if ((!_alreadyFetchedSalesPerson || forceFetch || _alwaysFetchSalesPerson) && !base.IsSerializing && !base.IsDeserializing && !base.InDesignMode) { bool performLazyLoading = base.CheckIfLazyLoadingShouldOccur(SalesPersonQuotaHistoryEntity.Relations.SalesPersonEntityUsingSalesPersonID); SalesPersonEntity newEntity = new SalesPersonEntity(); if (base.ParticipatesInTransaction) { base.Transaction.Add(newEntity); } bool fetchResult = false; if (performLazyLoading) { fetchResult = newEntity.FetchUsingPK(this.SalesPersonID); } if (fetchResult) { if (base.ActiveContext != null) { newEntity = (SalesPersonEntity)base.ActiveContext.Get(newEntity); } this.SalesPerson = newEntity; } else { if (_salesPersonReturnsNewIfNotFound) { if (performLazyLoading || (!performLazyLoading && (_salesPerson == null))) { this.SalesPerson = newEntity; } } else { this.SalesPerson = null; } } _alreadyFetchedSalesPerson = fetchResult; if (base.ParticipatesInTransaction && !fetchResult) { base.Transaction.Remove(newEntity); } } return(_salesPerson); }
/// <summary> Removes the sync logic for member _salesPerson</summary> /// <param name="signalRelatedEntity">If set to true, it will call the related entity's UnsetRelatedEntity method</param> /// <param name="resetFKFields">if set to true it will also reset the FK fields pointing to the related entity</param> private void DesetupSyncSalesPerson(bool signalRelatedEntity, bool resetFKFields) { base.PerformDesetupSyncRelatedEntity(_salesPerson, new PropertyChangedEventHandler(OnSalesPersonPropertyChanged), "SalesPerson", SalesPersonQuotaHistoryEntity.Relations.SalesPersonEntityUsingSalesPersonID, true, signalRelatedEntity, "SalesPersonQuotaHistory", resetFKFields, new int[] { (int)SalesPersonQuotaHistoryFieldIndex.SalesPersonID }); _salesPerson = null; }