Пример #1
0
        /// <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>
        private void DesetupSyncRole(bool signalRelatedEntity)
        {
            if(_role != null)
            {

                _role.AfterSave-=new EventHandler(OnEntityAfterSave);
                base.UnsetEntitySyncInformation("Role", _role, UserRoleLinkEntity.Relations.RoleEntityUsingRoleName);
                if(signalRelatedEntity)
                {
                    _role.UnsetRelatedEntity(this, "UserRoleLink");
                }
                SetNewFieldValue((int)UserRoleLinkFieldIndex.RoleName, null);
                _role = null;
            }
        }
Пример #2
0
        /// <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(IEntity2 relatedEntity)
        {
            DesetupSyncRole(true);
            if(relatedEntity!=null)
            {
                _role = (RoleEntity)relatedEntity;
                _role.ActiveContext = base.ActiveContext;
                _role.AfterSave+=new EventHandler(OnEntityAfterSave);
                base.SetEntitySyncInformation("Role", _role, UserRoleLinkEntity.Relations.RoleEntityUsingRoleName);

            }
        }
Пример #3
0
        /// <summary> Initializes the class members</summary>
        protected virtual void InitClassMembers()
        {
            _role = null;
            _user = null;

            // __LLBLGENPRO_USER_CODE_REGION_START InitClassMembers
            // __LLBLGENPRO_USER_CODE_REGION_END
        }
Пример #4
0
 /// <summary>Sets the field on index fieldIndex to the new value value. Marks also the fields object as dirty.</summary>
 /// <param name="fieldIndex">Index of field to set the new value of</param>
 /// <param name="value">Value to set</param>
 /// <returns>true if the value is actually set, false otherwise.</returns>
 /// <remarks>Dereferences a related object in an 1:1/m:1 relation if the field is an FK field and responsible for the reference of that particular related object.</remarks>
 /// <exception cref="ArgumentOutOfRangeException">When fieldIndex is smaller than 0 or bigger than the number of fields in the fields collection.</exception>
 public override bool SetNewFieldValue(int fieldIndex, object value)
 {
     bool toReturn = base.SetNewFieldValue (fieldIndex, value, false);
     if(toReturn && Enum.IsDefined(typeof(UserRoleLinkFieldIndex), fieldIndex))
     {
         switch((UserRoleLinkFieldIndex)fieldIndex)
         {
             case UserRoleLinkFieldIndex.UserId:
                 DecoupleEventsUser();
                 _user = null;
                 break;
             case UserRoleLinkFieldIndex.RoleName:
                 DecoupleEventsRole();
                 _role = null;
                 break;
             default:
                 break;
         }
         base.PostFieldValueSetAction(toReturn);
         switch((UserRoleLinkFieldIndex)fieldIndex)
         {
             case UserRoleLinkFieldIndex.UserId:
                 OnUserIdChanged();
                 break;
             case UserRoleLinkFieldIndex.RoleName:
                 OnRoleNameChanged();
                 break;
             default:
                 break;
         }
     }
     return toReturn;
 }
Пример #5
0
        protected UserRoleLinkEntity(SerializationInfo info, StreamingContext context)
            : base(info, context)
        {
            _role = (RoleEntity)info.GetValue("_role", typeof(RoleEntity));
            if(_role!=null)
            {
                _role.AfterSave+=new EventHandler(OnEntityAfterSave);
            }
            _user = (UserEntity)info.GetValue("_user", typeof(UserEntity));
            if(_user!=null)
            {
                _user.AfterSave+=new EventHandler(OnEntityAfterSave);
            }

            // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor
            // __LLBLGENPRO_USER_CODE_REGION_END
        }
Пример #6
0
        /// <summary>Creates a new RoleEntity instance but uses a special constructor which will set the Fields object of the new
        /// IEntity2 instance to the passed in fields object. Implement this method to support multi-type in single table inheritance.</summary>
        /// <param name="fields">Populated IEntityFields2 object for the new IEntity2 to create</param>
        /// <returns>Fully created and populated (due to the IEntityFields2 object) IEntity2 object</returns>
        public virtual IEntity2 Create(IEntityFields2 fields)
        {
            IEntity2 toReturn = new RoleEntity(fields);

            // __LLBLGENPRO_USER_CODE_REGION_START CreateNewRoleUsingFields
            // __LLBLGENPRO_USER_CODE_REGION_END
            return toReturn;
        }
Пример #7
0
        /// <summary>Creates a new, empty RoleEntity object.</summary>
        /// <returns>A new, empty RoleEntity object.</returns>
        public virtual IEntity2 Create()
        {
            IEntity2 toReturn = new RoleEntity();

            // __LLBLGENPRO_USER_CODE_REGION_START CreateNewRole
            // __LLBLGENPRO_USER_CODE_REGION_END
            return toReturn;
        }