/// <summary> Removes the sync logic for member _user</summary> /// <param name="signalRelatedEntity">If set to true, it will call the related entity's UnsetRelatedEntity method</param> private void DesetupSyncUser(bool signalRelatedEntity) { if(_user != null) { _user.AfterSave-=new EventHandler(OnEntityAfterSave); base.UnsetEntitySyncInformation("User", _user, UserRoleLinkEntity.Relations.UserEntityUsingUserId); if(signalRelatedEntity) { _user.UnsetRelatedEntity(this, "UserRoleLink"); } SetNewFieldValue((int)UserRoleLinkFieldIndex.UserId, null); _user = null; } }
/// <summary> setups the sync logic for member _user</summary> /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param> private void SetupSyncUser(IEntity2 relatedEntity) { DesetupSyncUser(true); if(relatedEntity!=null) { _user = (UserEntity)relatedEntity; _user.ActiveContext = base.ActiveContext; _user.AfterSave+=new EventHandler(OnEntityAfterSave); base.SetEntitySyncInformation("User", _user, UserRoleLinkEntity.Relations.UserEntityUsingUserId); } }
/// <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 }
/// <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; }
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 }
/// <summary>Creates a new UserEntity 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 UserEntity(fields); // __LLBLGENPRO_USER_CODE_REGION_START CreateNewUserUsingFields // __LLBLGENPRO_USER_CODE_REGION_END return toReturn; }
/// <summary>Creates a new, empty UserEntity object.</summary> /// <returns>A new, empty UserEntity object.</returns> public virtual IEntity2 Create() { IEntity2 toReturn = new UserEntity(); // __LLBLGENPRO_USER_CODE_REGION_START CreateNewUser // __LLBLGENPRO_USER_CODE_REGION_END return toReturn; }