Ejemplo n.º 1
0
		public static UserEntity FetchUser(DataAccessAdapterBase adapter, PrefetchPath2 prefetchPath, long UserId)
		{
			UserEntity _UserEntity = new UserEntity(UserId);
			adapter.FetchEntity(_UserEntity, prefetchPath);
			return _UserEntity;
		}
		/// <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>
		/// <param name="resetFKFields">if set to true it will also reset the FK fields pointing to the related entity</param>
		private void DesetupSyncUser(bool signalRelatedEntity, bool resetFKFields)
		{
			this.PerformDesetupSyncRelatedEntity( _user, new PropertyChangedEventHandler( OnUserPropertyChanged ), "User", NinjaSoftware.Enio.CoolJ.RelationClasses.StaticAuditInfoRelations.UserEntityUsingUserIdStatic, true, signalRelatedEntity, "AuditInfoCollection", resetFKFields, new int[] { (int)AuditInfoFieldIndex.UserId } );
			_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(IEntityCore relatedEntity)
		{
			if(_user!=relatedEntity)
			{
				DesetupSyncUser(true, true);
				_user = (UserEntity)relatedEntity;
				this.PerformSetupSyncRelatedEntity( _user, new PropertyChangedEventHandler( OnUserPropertyChanged ), "User", NinjaSoftware.Enio.CoolJ.RelationClasses.StaticAuditInfoRelations.UserEntityUsingUserIdStatic, true, new string[] {  } );
			}
		}
		protected AuditInfoEntity(SerializationInfo info, StreamingContext context) : base(info, context)
		{
			if(SerializationHelper.Optimization != SerializationOptimization.Fast) 
			{
				_auditInfoActionType = (AuditInfoActionTypeRoEntity)info.GetValue("_auditInfoActionType", typeof(AuditInfoActionTypeRoEntity));
				if(_auditInfoActionType!=null)
				{
					_auditInfoActionType.AfterSave+=new EventHandler(OnEntityAfterSave);
				}
				_entity = (EntityRoEntity)info.GetValue("_entity", typeof(EntityRoEntity));
				if(_entity!=null)
				{
					_entity.AfterSave+=new EventHandler(OnEntityAfterSave);
				}
				_user = (UserEntity)info.GetValue("_user", typeof(UserEntity));
				if(_user!=null)
				{
					_user.AfterSave+=new EventHandler(OnEntityAfterSave);
				}
				this.FixupDeserialization(FieldInfoProviderSingleton.GetInstance());
			}
			// __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor
			// __LLBLGENPRO_USER_CODE_REGION_END
		}