/// <summary>Creates a new, empty RoleEntity object.</summary>
        /// <returns>A new, empty RoleEntity object.</returns>
        public override IEntity Create()
        {
            IEntity toReturn = new RoleEntity();

            // __LLBLGENPRO_USER_CODE_REGION_START CreateNewRole
            // __LLBLGENPRO_USER_CODE_REGION_END
            return toReturn;
        }
 /// <summary> setups the sync logic for member _role</summary>
 /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
 private void SetupSyncRole(IEntity relatedEntity)
 {
     if(_role!=relatedEntity)
     {
         DesetupSyncRole(true, true);
         _role = (RoleEntity)relatedEntity;
         this.PerformSetupSyncRelatedEntity( _role, new PropertyChangedEventHandler( OnRolePropertyChanged ), "Role", ProductSearchEngine.RelationClasses.StaticMembershipRelations.RoleEntityUsingRoleIdStatic, true, ref _alreadyFetchedRole, new string[] {  } );
     }
 }
 /// <summary> Retrieves the related entity of type 'RoleEntity', 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 'RoleEntity' which is related to this entity.</returns>
 public virtual RoleEntity GetSingleRole(bool forceFetch)
 {
     if( ( !_alreadyFetchedRole || forceFetch || _alwaysFetchRole) && !this.IsSerializing && !this.IsDeserializing  && !this.InDesignMode)
     {
         bool performLazyLoading = this.CheckIfLazyLoadingShouldOccur(Relations.RoleEntityUsingRoleId);
         RoleEntity newEntity = new RoleEntity();
         bool fetchResult = false;
         if(performLazyLoading)
         {
             AddToTransactionIfNecessary(newEntity);
             fetchResult = newEntity.FetchUsingPK(this.RoleId.GetValueOrDefault());
         }
         if(fetchResult)
         {
             newEntity = (RoleEntity)GetFromActiveContext(newEntity);
         }
         else
         {
             if(!_roleReturnsNewIfNotFound)
             {
                 RemoveFromTransactionIfNecessary(newEntity);
                 newEntity = null;
             }
         }
         this.Role = newEntity;
         _alreadyFetchedRole = fetchResult;
     }
     return _role;
 }
 /// <summary> Removes the sync logic for member _role</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 DesetupSyncRole(bool signalRelatedEntity, bool resetFKFields)
 {
     this.PerformDesetupSyncRelatedEntity( _role, new PropertyChangedEventHandler( OnRolePropertyChanged ), "Role", ProductSearchEngine.RelationClasses.StaticMembershipRelations.RoleEntityUsingRoleIdStatic, true, signalRelatedEntity, "Memberships", resetFKFields, new int[] { (int)MembershipFieldIndex.RoleId } );
     _role = null;
 }
        /// <summary>Private CTor for deserialization</summary>
        /// <param name="info"></param>
        /// <param name="context"></param>
        protected MembershipEntity(SerializationInfo info, StreamingContext context)
            : base(info, context)
        {
            _stores = (ProductSearchEngine.CollectionClasses.StoreCollection)info.GetValue("_stores", typeof(ProductSearchEngine.CollectionClasses.StoreCollection));
            _alwaysFetchStores = info.GetBoolean("_alwaysFetchStores");
            _alreadyFetchedStores = info.GetBoolean("_alreadyFetchedStores");
            _role = (RoleEntity)info.GetValue("_role", typeof(RoleEntity));
            if(_role!=null)
            {
                _role.AfterSave+=new EventHandler(OnEntityAfterSave);
            }
            _roleReturnsNewIfNotFound = info.GetBoolean("_roleReturnsNewIfNotFound");
            _alwaysFetchRole = info.GetBoolean("_alwaysFetchRole");
            _alreadyFetchedRole = info.GetBoolean("_alreadyFetchedRole");

            _storeInformation = (StoreInformationEntity)info.GetValue("_storeInformation", typeof(StoreInformationEntity));
            if(_storeInformation!=null)
            {
                _storeInformation.AfterSave+=new EventHandler(OnEntityAfterSave);
            }
            _storeInformationReturnsNewIfNotFound = info.GetBoolean("_storeInformationReturnsNewIfNotFound");
            _alwaysFetchStoreInformation = info.GetBoolean("_alwaysFetchStoreInformation");
            _alreadyFetchedStoreInformation = info.GetBoolean("_alreadyFetchedStoreInformation");
            this.FixupDeserialization(FieldInfoProviderSingleton.GetInstance(), PersistenceInfoProviderSingleton.GetInstance());
            // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor
            // __LLBLGENPRO_USER_CODE_REGION_END
        }