Ejemplo n.º 1
0
        public override void Deactivate(IActivationContext context)
        {
            if (!Alive() || !ShouldStoreField())
            {
                return;
            }
            bool isEnumClass = _containingClass.IsEnum();

            if (_isPrimitive && !_isArray)
            {
                if (!isEnumClass)
                {
                    object nullValue = _reflectField.GetFieldType().NullValue();
                    FieldAccessor().Set(_reflectField, context.TargetObject(), nullValue);
                }
                return;
            }
            if (context.Depth().RequiresActivation())
            {
                CascadeActivation(context);
            }
            if (!isEnumClass)
            {
                FieldAccessor().Set(_reflectField, context.TargetObject(), null);
            }
        }
Ejemplo n.º 2
0
 protected object CascadingTarget(IActivationContext context)
 {
     if (context.Depth().Mode().IsDeactivate())
     {
         if (null == _reflectField)
         {
             return(null);
         }
         return(FieldAccessor().Get(_reflectField, context.TargetObject()));
     }
     return(GetOrCreate(context.Transaction(), context.TargetObject()));
 }
Ejemplo n.º 3
0
        private void CascadeActivation(IActivationContext context)
        {
            IActivationDepth depth = context.Depth();

            if (!depth.RequiresActivation())
            {
                return;
            }
            if (depth.Mode().IsDeactivate())
            {
                Container().StillToDeactivate(_transaction, context.TargetObject(), depth, false);
            }
            else
            {
                // FIXME: [TA] do we really need to check for isValueType here?
                Db4objects.Db4o.Internal.ClassMetadata classMetadata = context.ClassMetadata();
                if (classMetadata.IsStruct())
                {
                    classMetadata.CascadeActivation(context);
                }
                else
                {
                    Container().StillToActivate(context);
                }
            }
        }
Ejemplo n.º 4
0
		private void CascadeActivation(IActivationContext context)
		{
			IActivationDepth depth = context.Depth();
			if (!depth.RequiresActivation())
			{
				return;
			}
			if (depth.Mode().IsDeactivate())
			{
				Container().StillToDeactivate(_transaction, context.TargetObject(), depth, false);
			}
			else
			{
				// FIXME: [TA] do we really need to check for isValueType here?
				Db4objects.Db4o.Internal.ClassMetadata classMetadata = context.ClassMetadata();
				if (classMetadata.IsStruct())
				{
					classMetadata.CascadeActivation(context);
				}
				else
				{
					Container().StillToActivate(context);
				}
			}
		}
Ejemplo n.º 5
0
 public override void Deactivate(IActivationContext context)
 {
     if (context.Depth().RequiresActivation())
     {
         CascadeActivation(context);
     }
     SetOn(context.Transaction(), context.TargetObject(), null);
 }
Ejemplo n.º 6
0
 public void CascadeActivation(IActivationContext context)
 {
     ICollection collection = ((ICollection)context.TargetObject());
     foreach (object item in collection)
     {
         context.CascadeActivationToChild(item);
     }
 }
Ejemplo n.º 7
0
 public void CascadeActivation(IActivationContext context)
 {
     var all = ((ICollection) context.TargetObject()).GetEnumerator();
     while (all.MoveNext())
     {
         context.CascadeActivationToChild(all.Current);
     }
 }
Ejemplo n.º 8
0
        public void CascadeActivation(IActivationContext context)
        {
            var all = ((ICollection)context.TargetObject()).GetEnumerator();

            while (all.MoveNext())
            {
                context.CascadeActivationToChild(all.Current);
            }
        }
Ejemplo n.º 9
0
        public void CascadeActivation(IActivationContext context)
        {
            ICollection collection = ((ICollection)context.TargetObject());

            foreach (object item in collection)
            {
                context.CascadeActivationToChild(item);
            }
        }
Ejemplo n.º 10
0
		public virtual void CascadeActivation(IActivationContext context)
		{
			object targetObject = context.TargetObject();
			if (IsPlainObject(targetObject))
			{
				return;
			}
			ITypeHandler4 typeHandler = TypeHandlerForObject(targetObject);
			Handlers4.CascadeActivation(context, typeHandler);
		}
Ejemplo n.º 11
0
 public void CascadeActivation(IActivationContext context)
 {
     var map = (IDictionary) context.TargetObject();
     var keys = (map).Keys.GetEnumerator();
     while (keys.MoveNext())
     {
         var key = keys.Current;
         context.CascadeActivationToChild(key);
         context.CascadeActivationToChild(map[key]);
     }
 }
Ejemplo n.º 12
0
        public void CascadeActivation(IActivationContext context)
        {
            IDictionary map  = (IDictionary)context.TargetObject();
            IEnumerator keys = (map).Keys.GetEnumerator();

            while (keys.MoveNext())
            {
                object key = keys.Current;
                context.CascadeActivationToChild(key);
                context.CascadeActivationToChild(map[key]);
            }
        }
Ejemplo n.º 13
0
        public virtual void CascadeActivation(IActivationContext context)
        {
            object targetObject = context.TargetObject();

            if (IsPlainObject(targetObject))
            {
                return;
            }
            ITypeHandler4 typeHandler = TypeHandlerForObject(targetObject);

            Handlers4.CascadeActivation(context, typeHandler);
        }
Ejemplo n.º 14
0
        public void CascadeActivation(IActivationContext context)
        {
            IEnumerable collection = ((IEnumerable)context.TargetObject());

            // TODO: detect the element type
            // and return immediately when it's a primitive

            foreach (object item in collection)
            {
                context.CascadeActivationToChild(item);
            }
        }
Ejemplo n.º 15
0
		public void CascadeActivation(IActivationContext context)
		{
            IEnumerable collection = ((IEnumerable)context.TargetObject());

			// TODO: detect the element type
			// and return immediately when it's a primitive

			foreach (object item in collection)
			{
				context.CascadeActivationToChild(item);
			}
		}
Ejemplo n.º 16
0
		public void CascadeActivation(IActivationContext context)
		{
			if (!Handlers4.IsCascading(_handler))
			{
				return;
			}
			ObjectContainerBase container = context.Container();
			IEnumerator all = AllElements(container, context.TargetObject());
			while (all.MoveNext())
			{
				context.CascadeActivationToChild(all.Current);
			}
		}
Ejemplo n.º 17
0
        public void CascadeActivation(IActivationContext context)
        {
            if (!Handlers4.IsCascading(_handler))
            {
                return;
            }
            ObjectContainerBase container = context.Container();
            IEnumerator         all       = AllElements(container, context.TargetObject());

            while (all.MoveNext())
            {
                context.CascadeActivationToChild(all.Current);
            }
        }
Ejemplo n.º 18
0
        private void EnsureObjectIsActive(IActivationContext context)
        {
            if (!context.Depth().Mode().IsActivate())
            {
                return;
            }
            if (Handlers4.IsValueType(GetHandler()))
            {
                return;
            }
            ObjectContainerBase container     = context.Container();
            ClassMetadata       classMetadata = container.ClassMetadataForObject(context.TargetObject
                                                                                     ());

            if (classMetadata == null || !classMetadata.HasIdentity())
            {
                return;
            }
            if (container.IsActive(context.TargetObject()))
            {
                return;
            }
            container.StillToActivate(context.Descend());
        }
Ejemplo n.º 19
0
		private void ReadForActivation(IActivationContext context)
		{
			Read(context.Transaction(), null, context.TargetObject(), context.Depth(), Const4
				.AddMembersToIdTreeOnly, false);
		}
Ejemplo n.º 20
0
		protected object CascadingTarget(IActivationContext context)
		{
			if (context.Depth().Mode().IsDeactivate())
			{
				if (null == _reflectField)
				{
					return null;
				}
				return FieldAccessor().Get(_reflectField, context.TargetObject());
			}
			return GetOrCreate(context.Transaction(), context.TargetObject());
		}
Ejemplo n.º 21
0
		public override void Deactivate(IActivationContext context)
		{
			if (context.Depth().RequiresActivation())
			{
				CascadeActivation(context);
			}
			SetOn(context.Transaction(), context.TargetObject(), null);
		}
Ejemplo n.º 22
0
		public override void Deactivate(IActivationContext context)
		{
			if (!Alive() || !ShouldStoreField())
			{
				return;
			}
			bool isEnumClass = _containingClass.IsEnum();
			if (_isPrimitive && !_isArray)
			{
				if (!isEnumClass)
				{
					object nullValue = _reflectField.GetFieldType().NullValue();
					FieldAccessor().Set(_reflectField, context.TargetObject(), nullValue);
				}
				return;
			}
			if (context.Depth().RequiresActivation())
			{
				CascadeActivation(context);
			}
			if (!isEnumClass)
			{
				FieldAccessor().Set(_reflectField, context.TargetObject(), null);
			}
		}
Ejemplo n.º 23
0
 private void ReadForActivation(IActivationContext context)
 {
     Read(context.Transaction(), null, context.TargetObject(), context.Depth(), Const4
          .AddMembersToIdTreeOnly, false);
 }
Ejemplo n.º 24
0
		private bool ProcessedByImmediateActivation(IActivationContext context)
		{
			if (!StackIsSmall())
			{
				return false;
			}
			if (!context.Depth().RequiresActivation())
			{
				return true;
			}
			ObjectReference @ref = context.Transaction().ReferenceForObject(context.TargetObject
				());
			if (@ref == null)
			{
				return false;
			}
			if (HandledInCurrentTopLevelCall(@ref))
			{
				return true;
			}
			FlagAsHandled(@ref);
			IncStackDepth();
			try
			{
				@ref.ActivateInternal(context);
			}
			finally
			{
				DecStackDepth();
			}
			return true;
		}
Ejemplo n.º 25
0
		public void StillToActivate(IActivationContext context)
		{
			// TODO: We don't want the simple classes to search the hc_tree
			// Kick them out here.
			//		if (a_object != null) {
			//			Class clazz = a_object.getClass();
			//			if(! clazz.isPrimitive()){
			if (ProcessedByImmediateActivation(context))
			{
				return;
			}
			_stillToActivate = StillTo1(context.Transaction(), _stillToActivate, context.TargetObject
				(), context.Depth());
		}
Ejemplo n.º 26
0
 public virtual void CascadeActivation(IActivationContext context)
 {
     if (!ObjectCanActivate(context.Transaction(), context.TargetObject()))
     {
         return;
     }
     TraverseAllAspects(new _ITraverseAspectCommand_162(context));
 }
Ejemplo n.º 27
0
		private void EnsureObjectIsActive(IActivationContext context)
		{
			if (!context.Depth().Mode().IsActivate())
			{
				return;
			}
			if (Handlers4.IsValueType(GetHandler()))
			{
				return;
			}
			ObjectContainerBase container = context.Container();
			ClassMetadata classMetadata = container.ClassMetadataForObject(context.TargetObject
				());
			if (classMetadata == null || !classMetadata.HasIdentity())
			{
				return;
			}
			if (container.IsActive(context.TargetObject()))
			{
				return;
			}
			container.StillToActivate(context.Descend());
		}