/// <summary> Retrieves the related entity of type 'CityEntity', 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 'CityEntity' which is related to this entity.</returns> public virtual CityEntity GetSingleCity(bool forceFetch) { if ((!_alreadyFetchedCity || forceFetch || _alwaysFetchCity) && !this.IsSerializing && !this.IsDeserializing && !this.InDesignMode) { bool performLazyLoading = this.CheckIfLazyLoadingShouldOccur(Relations.CityEntityUsingCityId); CityEntity newEntity = new CityEntity(); bool fetchResult = false; if (performLazyLoading) { AddToTransactionIfNecessary(newEntity); fetchResult = newEntity.FetchUsingPK(this.CityId.GetValueOrDefault()); } if (fetchResult) { newEntity = (CityEntity)GetFromActiveContext(newEntity); } else { if (!_cityReturnsNewIfNotFound) { RemoveFromTransactionIfNecessary(newEntity); newEntity = null; } } this.City = newEntity; _alreadyFetchedCity = fetchResult; } return(_city); }
/// <summary> setups the sync logic for member _city</summary> /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param> private void SetupSyncCity(IEntity relatedEntity) { if (_city != relatedEntity) { DesetupSyncCity(true, true); _city = (CityEntity)relatedEntity; this.PerformSetupSyncRelatedEntity(_city, new PropertyChangedEventHandler(OnCityPropertyChanged), "City", ProductSearchEngine.RelationClasses.StaticStoreInformationRelations.CityEntityUsingCityIdStatic, true, ref _alreadyFetchedCity, new string[] { }); } }
/// <summary>Private CTor for deserialization</summary> /// <param name="info"></param> /// <param name="context"></param> protected StoreInformationEntity(SerializationInfo info, StreamingContext context) : base(info, context) { _memberships = (ProductSearchEngine.CollectionClasses.MembershipCollection)info.GetValue("_memberships", typeof(ProductSearchEngine.CollectionClasses.MembershipCollection)); _alwaysFetchMemberships = info.GetBoolean("_alwaysFetchMemberships"); _alreadyFetchedMemberships = info.GetBoolean("_alreadyFetchedMemberships"); _city = (CityEntity)info.GetValue("_city", typeof(CityEntity)); if (_city != null) { _city.AfterSave += new EventHandler(OnEntityAfterSave); } _cityReturnsNewIfNotFound = info.GetBoolean("_cityReturnsNewIfNotFound"); _alwaysFetchCity = info.GetBoolean("_alwaysFetchCity"); _alreadyFetchedCity = info.GetBoolean("_alreadyFetchedCity"); this.FixupDeserialization(FieldInfoProviderSingleton.GetInstance(), PersistenceInfoProviderSingleton.GetInstance()); // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor // __LLBLGENPRO_USER_CODE_REGION_END }
/// <summary>Creates a new, empty CityEntity object.</summary> /// <returns>A new, empty CityEntity object.</returns> public override IEntity Create() { IEntity toReturn = new CityEntity(); // __LLBLGENPRO_USER_CODE_REGION_START CreateNewCity // __LLBLGENPRO_USER_CODE_REGION_END return toReturn; }
/// <summary> Removes the sync logic for member _city</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 DesetupSyncCity(bool signalRelatedEntity, bool resetFKFields) { this.PerformDesetupSyncRelatedEntity(_city, new PropertyChangedEventHandler(OnCityPropertyChanged), "City", ProductSearchEngine.RelationClasses.StaticStoreInformationRelations.CityEntityUsingCityIdStatic, true, signalRelatedEntity, "StoreInformations", resetFKFields, new int[] { (int)StoreInformationFieldIndex.CityId }); _city = null; }
/// <summary> setups the sync logic for member _city</summary> /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param> private void SetupSyncCity(IEntity relatedEntity) { if(_city!=relatedEntity) { DesetupSyncCity(true, true); _city = (CityEntity)relatedEntity; this.PerformSetupSyncRelatedEntity( _city, new PropertyChangedEventHandler( OnCityPropertyChanged ), "City", ProductSearchEngine.RelationClasses.StaticStoreInformationRelations.CityEntityUsingCityIdStatic, true, ref _alreadyFetchedCity, new string[] { } ); } }
/// <summary> Removes the sync logic for member _city</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 DesetupSyncCity(bool signalRelatedEntity, bool resetFKFields) { this.PerformDesetupSyncRelatedEntity( _city, new PropertyChangedEventHandler( OnCityPropertyChanged ), "City", ProductSearchEngine.RelationClasses.StaticStoreInformationRelations.CityEntityUsingCityIdStatic, true, signalRelatedEntity, "StoreInformations", resetFKFields, new int[] { (int)StoreInformationFieldIndex.CityId } ); _city = null; }
/// <summary> Retrieves the related entity of type 'CityEntity', 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 'CityEntity' which is related to this entity.</returns> public virtual CityEntity GetSingleCity(bool forceFetch) { if( ( !_alreadyFetchedCity || forceFetch || _alwaysFetchCity) && !this.IsSerializing && !this.IsDeserializing && !this.InDesignMode) { bool performLazyLoading = this.CheckIfLazyLoadingShouldOccur(Relations.CityEntityUsingCityId); CityEntity newEntity = new CityEntity(); bool fetchResult = false; if(performLazyLoading) { AddToTransactionIfNecessary(newEntity); fetchResult = newEntity.FetchUsingPK(this.CityId.GetValueOrDefault()); } if(fetchResult) { newEntity = (CityEntity)GetFromActiveContext(newEntity); } else { if(!_cityReturnsNewIfNotFound) { RemoveFromTransactionIfNecessary(newEntity); newEntity = null; } } this.City = newEntity; _alreadyFetchedCity = fetchResult; } return _city; }
/// <summary>Private CTor for deserialization</summary> /// <param name="info"></param> /// <param name="context"></param> protected StoreInformationEntity(SerializationInfo info, StreamingContext context) : base(info, context) { _memberships = (ProductSearchEngine.CollectionClasses.MembershipCollection)info.GetValue("_memberships", typeof(ProductSearchEngine.CollectionClasses.MembershipCollection)); _alwaysFetchMemberships = info.GetBoolean("_alwaysFetchMemberships"); _alreadyFetchedMemberships = info.GetBoolean("_alreadyFetchedMemberships"); _city = (CityEntity)info.GetValue("_city", typeof(CityEntity)); if(_city!=null) { _city.AfterSave+=new EventHandler(OnEntityAfterSave); } _cityReturnsNewIfNotFound = info.GetBoolean("_cityReturnsNewIfNotFound"); _alwaysFetchCity = info.GetBoolean("_alwaysFetchCity"); _alreadyFetchedCity = info.GetBoolean("_alreadyFetchedCity"); this.FixupDeserialization(FieldInfoProviderSingleton.GetInstance(), PersistenceInfoProviderSingleton.GetInstance()); // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor // __LLBLGENPRO_USER_CODE_REGION_END }