/// <summary> Retrieves the related entity of type 'ActionRightEntity', 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 'ActionRightEntity' which is related to this entity.</returns>
 public virtual ActionRightEntity GetSingleActionRight(bool forceFetch)
 {
     if ((!_alreadyFetchedActionRight || forceFetch || _alwaysFetchActionRight) && !this.IsSerializing && !this.IsDeserializing && !this.InDesignMode)
     {
         bool performLazyLoading     = this.CheckIfLazyLoadingShouldOccur(Relations.ActionRightEntityUsingActionRightID);
         ActionRightEntity newEntity = new ActionRightEntity();
         bool fetchResult            = false;
         if (performLazyLoading)
         {
             AddToTransactionIfNecessary(newEntity);
             fetchResult = newEntity.FetchUsingPK(this.ActionRightID);
         }
         if (fetchResult)
         {
             newEntity = (ActionRightEntity)GetFromActiveContext(newEntity);
         }
         else
         {
             if (!_actionRightReturnsNewIfNotFound)
             {
                 RemoveFromTransactionIfNecessary(newEntity);
                 newEntity = null;
             }
         }
         this.ActionRight           = newEntity;
         _alreadyFetchedActionRight = fetchResult;
     }
     return(_actionRight);
 }
Esempio n. 2
0
        /// <summary>Creates a new, empty ActionRightEntity object.</summary>
        /// <returns>A new, empty ActionRightEntity object.</returns>
        public override IEntity Create()
        {
            IEntity toReturn = new ActionRightEntity();

            // __LLBLGENPRO_USER_CODE_REGION_START CreateNewActionRight
            // __LLBLGENPRO_USER_CODE_REGION_END
            return toReturn;
        }
 /// <summary> setups the sync logic for member _actionRight</summary>
 /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
 private void SetupSyncActionRight(IEntityCore relatedEntity)
 {
     if (_actionRight != relatedEntity)
     {
         DesetupSyncActionRight(true, true);
         _actionRight = (ActionRightEntity)relatedEntity;
         this.PerformSetupSyncRelatedEntity(_actionRight, new PropertyChangedEventHandler(OnActionRightPropertyChanged), "ActionRight", SD.HnD.DAL.RelationClasses.StaticRoleSystemActionRightRelations.ActionRightEntityUsingActionRightIDStatic, true, ref _alreadyFetchedActionRight, new string[] {  });
     }
 }
        /// <summary>Private CTor for deserialization</summary>
        /// <param name="info"></param>
        /// <param name="context"></param>
        protected RoleSystemActionRightEntityBase(SerializationInfo info, StreamingContext context) : base(info, context)
        {
            _actionRight = (ActionRightEntity)info.GetValue("_actionRight", typeof(ActionRightEntity));
            if (_actionRight != null)
            {
                _actionRight.AfterSave += new EventHandler(OnEntityAfterSave);
            }
            _actionRightReturnsNewIfNotFound = info.GetBoolean("_actionRightReturnsNewIfNotFound");
            _alwaysFetchActionRight          = info.GetBoolean("_alwaysFetchActionRight");
            _alreadyFetchedActionRight       = info.GetBoolean("_alreadyFetchedActionRight");

            _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");
            this.FixupDeserialization(FieldInfoProviderSingleton.GetInstance(), PersistenceInfoProviderSingleton.GetInstance());
            // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor
            // __LLBLGENPRO_USER_CODE_REGION_END
        }
 /// <summary> setups the sync logic for member _actionRight</summary>
 /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
 private void SetupSyncActionRight(IEntityCore relatedEntity)
 {
     if(_actionRight!=relatedEntity)
     {
         DesetupSyncActionRight(true, true);
         _actionRight = (ActionRightEntity)relatedEntity;
         this.PerformSetupSyncRelatedEntity( _actionRight, new PropertyChangedEventHandler( OnActionRightPropertyChanged ), "ActionRight", SD.HnD.DAL.RelationClasses.StaticForumRoleForumActionRightRelations.ActionRightEntityUsingActionRightIDStatic, true, ref _alreadyFetchedActionRight, new string[] {  } );
     }
 }
 /// <summary> Removes the sync logic for member _actionRight</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 DesetupSyncActionRight(bool signalRelatedEntity, bool resetFKFields)
 {
     this.PerformDesetupSyncRelatedEntity( _actionRight, new PropertyChangedEventHandler( OnActionRightPropertyChanged ), "ActionRight", SD.HnD.DAL.RelationClasses.StaticForumRoleForumActionRightRelations.ActionRightEntityUsingActionRightIDStatic, true, signalRelatedEntity, "ForumRoleForumActionRights", resetFKFields, new int[] { (int)ForumRoleForumActionRightFieldIndex.ActionRightID } );
     _actionRight = null;
 }
 /// <summary> Retrieves the related entity of type 'ActionRightEntity', 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 'ActionRightEntity' which is related to this entity.</returns>
 public virtual ActionRightEntity GetSingleActionRight(bool forceFetch)
 {
     if( ( !_alreadyFetchedActionRight || forceFetch || _alwaysFetchActionRight) && !this.IsSerializing && !this.IsDeserializing  && !this.InDesignMode)
     {
         bool performLazyLoading = this.CheckIfLazyLoadingShouldOccur(Relations.ActionRightEntityUsingActionRightID);
         ActionRightEntity newEntity = new ActionRightEntity();
         bool fetchResult = false;
         if(performLazyLoading)
         {
             AddToTransactionIfNecessary(newEntity);
             fetchResult = newEntity.FetchUsingPK(this.ActionRightID);
         }
         if(fetchResult)
         {
             newEntity = (ActionRightEntity)GetFromActiveContext(newEntity);
         }
         else
         {
             if(!_actionRightReturnsNewIfNotFound)
             {
                 RemoveFromTransactionIfNecessary(newEntity);
                 newEntity = null;
             }
         }
         this.ActionRight = newEntity;
         _alreadyFetchedActionRight = fetchResult;
     }
     return _actionRight;
 }
        /// <summary>Private CTor for deserialization</summary>
        /// <param name="info"></param>
        /// <param name="context"></param>
        protected ForumRoleForumActionRightEntityBase(SerializationInfo info, StreamingContext context)
            : base(info, context)
        {
            _actionRight = (ActionRightEntity)info.GetValue("_actionRight", typeof(ActionRightEntity));
            if(_actionRight!=null)
            {
                _actionRight.AfterSave+=new EventHandler(OnEntityAfterSave);
            }
            _actionRightReturnsNewIfNotFound = info.GetBoolean("_actionRightReturnsNewIfNotFound");
            _alwaysFetchActionRight = info.GetBoolean("_alwaysFetchActionRight");
            _alreadyFetchedActionRight = info.GetBoolean("_alreadyFetchedActionRight");

            _forum = (ForumEntity)info.GetValue("_forum", typeof(ForumEntity));
            if(_forum!=null)
            {
                _forum.AfterSave+=new EventHandler(OnEntityAfterSave);
            }
            _forumReturnsNewIfNotFound = info.GetBoolean("_forumReturnsNewIfNotFound");
            _alwaysFetchForum = info.GetBoolean("_alwaysFetchForum");
            _alreadyFetchedForum = info.GetBoolean("_alreadyFetchedForum");

            _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");
            this.FixupDeserialization(FieldInfoProviderSingleton.GetInstance(), PersistenceInfoProviderSingleton.GetInstance());
            // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor
            // __LLBLGENPRO_USER_CODE_REGION_END
        }
 /// <summary> Removes the sync logic for member _actionRight</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 DesetupSyncActionRight(bool signalRelatedEntity, bool resetFKFields)
 {
     this.PerformDesetupSyncRelatedEntity(_actionRight, new PropertyChangedEventHandler(OnActionRightPropertyChanged), "ActionRight", SD.HnD.DAL.RelationClasses.StaticRoleSystemActionRightRelations.ActionRightEntityUsingActionRightIDStatic, true, signalRelatedEntity, "RoleSystemActionRights", resetFKFields, new int[] { (int)RoleSystemActionRightFieldIndex.ActionRightID });
     _actionRight = null;
 }