Exemplo n.º 1
0
        protected virtual void PerformRemoveAction(InverseAction action)
        {
            object             obj          = action.Obj;
            string             propertyName = action.PropertyName;
            object             value        = action.Value;
            IPropertyMap       propertyMap  = this.Context.DomainMap.MustGetClassMap(obj.GetType()).MustGetPropertyMap(propertyName);
            IObjectManager     om           = this.Context.ObjectManager;
            IList              list;
            IInterceptableList mList;
            bool stackMute = false;

            om.EnsurePropertyIsLoaded(obj, propertyMap);
            list  = (IList)om.GetPropertyValue(obj, propertyName);
            mList = list as IInterceptableList;
            if (mList != null)
            {
                stackMute        = mList.MuteNotify;
                mList.MuteNotify = true;
            }
            list.Remove(value);
            if (mList != null)
            {
                mList.MuteNotify = stackMute;
            }
            om.SetUpdatedStatus(obj, propertyName, true);

            this.Context.LogManager.Debug(this, "Performed cached inverse action", "Action type: " + action.ActionType.ToString() + ", Wrote to object of type: " + obj.GetType().ToString() + ", Property: " + propertyName + ", Value object type: " + value.GetType().ToString());               // do not localize
        }
Exemplo n.º 2
0
 protected virtual void RemoveActionFromMasters(InverseAction action)
 {
     if (inverseMasters.ContainsKey(action.Master))
     {
         ArrayList masterActions = (ArrayList)inverseMasters[action.Master];
         masterActions.Remove(action);
         if (masterActions.Count < 1)
         {
             inverseMasters.Remove(action.Master);
         }
     }
 }
Exemplo n.º 3
0
        protected virtual void AddAction(InverseActionType actionType, object obj, string propertyName, object value, object master)
        {
            if (value == null)
            {
                this.Context.LogManager.Debug(this, "Caching inverse action", "Action type: " + actionType.ToString() + ", Object of type: " + obj.GetType().ToString() + ", Property: " + propertyName + ", Value: null");                 // do not localize
            }
            else
            {
                this.Context.LogManager.Debug(this, "Caching inverse action", "Action type: " + actionType.ToString() + ", Object of type: " + obj.GetType().ToString() + ", Property: " + propertyName + ", Value type: " + value.GetType().ToString());                   // do not localize
            }
            InverseAction action = new InverseAction();

            action.ActionType   = actionType;
            action.Obj          = obj;
            action.PropertyName = propertyName;
            action.Value        = value;
            action.Master       = master;
            Hashtable objActions;
            ArrayList propActions;
            ArrayList masterActions;

            if (!(inverseActions.ContainsKey(obj)))
            {
                inverseActions[obj] = new Hashtable();
            }
            objActions = (Hashtable)inverseActions[obj];
            if (!(objActions.ContainsKey(propertyName)))
            {
                objActions[propertyName] = new ArrayList();
            }
            propActions = (ArrayList)objActions[propertyName];
            propActions.Add(action);


            if (!(inverseMasters.ContainsKey(master)))
            {
                inverseMasters[master] = new ArrayList();
            }
            masterActions = (ArrayList)inverseMasters[master];
            masterActions.Add(action);
        }
Exemplo n.º 4
0
        protected virtual void PerformSetAction(InverseAction action)
        {
            object         obj          = action.Obj;
            string         propertyName = action.PropertyName;
            object         value        = action.Value;
            IPropertyMap   propertyMap  = this.Context.DomainMap.MustGetClassMap(obj.GetType()).MustGetPropertyMap(propertyName);
            IObjectManager om           = this.Context.ObjectManager;

            om.EnsurePropertyIsLoaded(obj, propertyMap);
            om.SetPropertyValue(obj, propertyName, value);
            om.SetNullValueStatus(obj, propertyName, false);
            om.SetUpdatedStatus(obj, propertyName, true);

            if (value == null)
            {
                this.Context.LogManager.Debug(this, "Performed cached inverse action", "Action type: " + action.ActionType.ToString() + ", Wrote to object of type: " + obj.GetType().ToString() + ", Property: " + propertyName + ", Value: null");                 // do not localize
            }
            else
            {
                this.Context.LogManager.Debug(this, "Performed cached inverse action", "Action type: " + action.ActionType.ToString() + ", Wrote to object of type: " + obj.GetType().ToString() + ", Property: " + propertyName + ", Value object type: " + value.GetType().ToString());                   // do not localize
            }
        }
Exemplo n.º 5
0
        protected virtual void PerformSetAction(InverseAction action)
        {
            object obj = action.Obj;
            string propertyName = action.PropertyName;
            object value = action.Value;
            IPropertyMap propertyMap = this.Context.DomainMap.MustGetClassMap(obj.GetType()).MustGetPropertyMap(propertyName);
            IObjectManager om = this.Context.ObjectManager;
            om.EnsurePropertyIsLoaded(obj, propertyMap);
            om.SetPropertyValue(obj, propertyName, value);
            om.SetNullValueStatus(obj, propertyName, false);
            om.SetUpdatedStatus(obj, propertyName, true);

            if (value == null)
            {
                LogMessage message = new LogMessage("Performed cached inverse action");
                LogMessage verbose = new LogMessage("Action type: {0}, Wrote to object of type: {1}, Property: {2}, Value: null" , action.ActionType , obj.GetType(), propertyName);
                this.Context.LogManager.Debug(this, message,verbose ); // do not localize
            }
            else
            {
                LogMessage message = new LogMessage("Performed cached inverse action");
                LogMessage verbose = new LogMessage("Action type: {0}, Wrote to object of type: {1}, Property: {2}, Value object type: {3}" , action.ActionType, obj.GetType(), propertyName , value.GetType());

                this.Context.LogManager.Debug(this,message ,verbose); // do not localize
            }
        }
Exemplo n.º 6
0
 protected virtual void RemoveActionFromMasters(InverseAction action)
 {
     if (inverseMasters.ContainsKey(action.Master))
     {
         ArrayList masterActions = (ArrayList) inverseMasters[action.Master];
         masterActions.Remove(action);
         if (masterActions.Count < 1)
             inverseMasters.Remove(action.Master);
     }
 }
Exemplo n.º 7
0
        protected virtual void PerformRemoveAction(InverseAction action)
        {
            object obj = action.Obj;
            string propertyName = action.PropertyName;
            object value = action.Value;
            IPropertyMap propertyMap = this.Context.DomainMap.MustGetClassMap(obj.GetType()).MustGetPropertyMap(propertyName);
            IObjectManager om = this.Context.ObjectManager;
            IList list;
            IInterceptableList mList;
            bool stackMute = false;
            om.EnsurePropertyIsLoaded(obj, propertyMap);
            list = (IList) om.GetPropertyValue(obj, propertyName);
            mList = list as IInterceptableList;
            if (mList != null)
            {
                stackMute = mList.MuteNotify;
                mList.MuteNotify = true;
            }
            list.Remove(value);
            if (mList != null) { mList.MuteNotify = stackMute; }
            om.SetUpdatedStatus(obj, propertyName, true);

            LogMessage message = new LogMessage("Performed cached inverse action");
            LogMessage verbose = new LogMessage("Action type: {0}, Wrote to object of type: {1}, Property: {2}, Value object type: {3}" , action.ActionType,obj.GetType(),propertyName ,value.GetType());

            this.Context.LogManager.Debug(this,message , verbose); // do not localize
        }
Exemplo n.º 8
0
        protected virtual void AddAction(InverseActionType actionType, object obj, string propertyName, object value, object master)
        {
            if (value == null)
            {
                LogMessage message = new LogMessage("Caching inverse action");
                LogMessage verbose = new LogMessage("Action type: {0}, Object of type: {1}, Property: {2}, Value: null" , actionType, obj.GetType(),propertyName );
                this.Context.LogManager.Debug(this, message,verbose ); // do not localize
            }
            else
            {
                LogMessage message = new LogMessage("Caching inverse action");
                LogMessage verbose = new LogMessage("Action type: {0}, Object of type: {1}, Property: {2}, Value type: {3}" , actionType, obj.GetType(),propertyName,value.GetType()) ;
                this.Context.LogManager.Debug(this, message,verbose ); // do not localize

            }

            InverseAction action = new InverseAction() ;
            action.ActionType = actionType ;
            action.Obj = obj;
            action.PropertyName = propertyName;
            action.Value = value;
            action.Master = master;
            Hashtable objActions;
            ArrayList propActions;
            ArrayList masterActions;
            if (!(inverseActions.ContainsKey(obj)))
            {
                inverseActions[obj] = new Hashtable();
            }
            objActions = (Hashtable) inverseActions[obj] ;
            if (!(objActions.ContainsKey(propertyName)))
            {
                objActions[propertyName] = new ArrayList();
            }
            propActions = (ArrayList) objActions[propertyName] ;
            propActions.Add(action);

            if (!(inverseMasters.ContainsKey(master)))
            {
                inverseMasters[master] = new ArrayList();
            }
            masterActions = (ArrayList) inverseMasters[master] ;
            masterActions.Add(action);
        }
Exemplo n.º 9
0
		protected virtual void PerformSetAction(InverseAction action)
		{
			object obj = action.Obj;
			string propertyName = action.PropertyName;
			object value = action.Value;
			IPropertyMap propertyMap = this.Context.DomainMap.MustGetClassMap(obj.GetType()).MustGetPropertyMap(propertyName);
			IObjectManager om = this.Context.ObjectManager;
			om.EnsurePropertyIsLoaded(obj, propertyMap);
			om.SetPropertyValue(obj, propertyName, value);
			om.SetNullValueStatus(obj, propertyName, false);
			om.SetUpdatedStatus(obj, propertyName, true);

			if (value == null)
				this.Context.LogManager.Debug(this, "Performed cached inverse action", "Action type: " + action.ActionType.ToString() + ", Wrote to object of type: " + obj.GetType().ToString() + ", Property: " + propertyName + ", Value: null"); // do not localize
			else
				this.Context.LogManager.Debug(this, "Performed cached inverse action", "Action type: " + action.ActionType.ToString() + ", Wrote to object of type: " + obj.GetType().ToString() + ", Property: " + propertyName + ", Value object type: " + value.GetType().ToString()  ); // do not localize

		}
Exemplo n.º 10
0
		protected virtual void PerformAddAction(InverseAction action)
		{
			object obj = action.Obj;
			string propertyName = action.PropertyName;
			object value = action.Value;
			IPropertyMap propertyMap = this.Context.DomainMap.MustGetClassMap(obj.GetType()).MustGetPropertyMap(propertyName);
			if ( propertyMap == null) { return ;}
			IObjectManager om = this.Context.ObjectManager;
			IList list;
			IInterceptableList mList;
			bool stackMute = false;
			om.EnsurePropertyIsLoaded(obj, propertyMap);
			list = (IList) om.GetPropertyValue(obj, propertyName);
			mList = list as IInterceptableList;
			if (mList != null)
			{
				stackMute = mList.MuteNotify;
				mList.MuteNotify = true;
			}
			list.Add(value);
			if (mList != null) { mList.MuteNotify = stackMute; }
			om.SetUpdatedStatus(obj, propertyName, true);

			this.Context.LogManager.Debug(this, "Performed cached inverse action", "Action type: " + action.ActionType.ToString() + ", Wrote to object of type: " + obj.GetType().ToString() + ", Property: " + propertyName + ", Value object type: " + value.GetType().ToString()  ); // do not localize
		}
Exemplo n.º 11
0
		protected virtual void AddAction(InverseActionType actionType, object obj, string propertyName, object value, object master)
		{
			if (value == null)
				this.Context.LogManager.Debug(this, "Caching inverse action", "Action type: " + actionType.ToString() + ", Object of type: " + obj.GetType().ToString() + ", Property: " + propertyName + ", Value: null"); // do not localize
			else
				this.Context.LogManager.Debug(this, "Caching inverse action", "Action type: " + actionType.ToString() + ", Object of type: " + obj.GetType().ToString() + ", Property: " + propertyName + ", Value type: " + value.GetType().ToString()  ); // do not localize

			InverseAction action = new InverseAction() ;
			action.ActionType = actionType ;
			action.Obj = obj;
			action.PropertyName = propertyName;
			action.Value = value;
			action.Master = master;
			Hashtable objActions;
			ArrayList propActions;
			ArrayList masterActions;
			if (!(inverseActions.ContainsKey(obj)))
			{
				inverseActions[obj] = new Hashtable();
			}
			objActions = (Hashtable) inverseActions[obj] ;
			if (!(objActions.ContainsKey(propertyName)))
			{
				objActions[propertyName] = new ArrayList();
			}
			propActions = (ArrayList) objActions[propertyName] ;
			propActions.Add(action);			

            
			if (!(inverseMasters.ContainsKey(master)))
			{
				inverseMasters[master] = new ArrayList();
			}
			masterActions = (ArrayList) inverseMasters[master] ;
            masterActions.Add(action);
        }