Ejemplo n.º 1
0
        public virtual void TestDescendingFromNonTAAwareToTAAware()
        {
            IActivationDepth depth = NonTAAwareDepth();
            IActivationDepth child = depth.Descend(ClassMetadataFor(typeof(TransparentActivationDepthTestCase.TAAware
                                                                           )));

            Assert.IsFalse(child.RequiresActivation());
        }
Ejemplo n.º 2
0
        public virtual void TestDefaultActivationNonTAAware()
        {
            IActivationDepth depth = NonTAAwareDepth();

            Assert.IsTrue(depth.RequiresActivation());
            IActivationDepth child = depth.Descend(ClassMetadataFor(typeof(TransparentActivationDepthTestCase.NonTAAware
                                                                           )));

            Assert.IsTrue(child.RequiresActivation());
        }
Ejemplo n.º 3
0
 private void AssertDescendingDepth(int expectedDepth, IActivationDepth depth, Type
                                    clazz)
 {
     if (expectedDepth < 1)
     {
         Assert.IsFalse(depth.RequiresActivation());
         return;
     }
     Assert.IsTrue(depth.RequiresActivation());
     AssertDescendingDepth(expectedDepth - 1, depth.Descend(ClassMetadataFor(clazz)),
                           clazz);
 }
		private void AssertDescendingDepth(int expectedDepth, IActivationDepth depth, Type
			 clazz)
		{
			if (expectedDepth < 1)
			{
				Assert.IsFalse(depth.RequiresActivation());
				return;
			}
			Assert.IsTrue(depth.RequiresActivation());
			AssertDescendingDepth(expectedDepth - 1, depth.Descend(ClassMetadataFor(clazz)), 
				clazz);
		}
Ejemplo n.º 5
0
		// overridden to do nothing in YapObjectCarrier
		internal List4 StillTo1(Transaction trans, List4 still, object obj, IActivationDepth
			 depth)
		{
			if (obj == null || !depth.RequiresActivation())
			{
				return still;
			}
			ObjectReference @ref = trans.ReferenceForObject(obj);
			if (@ref != null)
			{
				if (HandledInCurrentTopLevelCall(@ref))
				{
					return still;
				}
				FlagAsHandled(@ref);
				return new List4(still, new ObjectContainerBase.PendingActivation(@ref, depth));
			}
			IReflectClass clazz = ReflectorForObject(obj);
			if (clazz.IsArray())
			{
				if (!clazz.GetComponentType().IsPrimitive())
				{
					IEnumerator arr = ArrayHandler.Iterator(clazz, obj);
					while (arr.MoveNext())
					{
						object current = arr.Current;
						if (current == null)
						{
							continue;
						}
						ClassMetadata classMetadata = ClassMetadataForObject(current);
						still = StillTo1(trans, still, current, depth.Descend(classMetadata));
					}
				}
				return still;
			}
			else
			{
				if (obj is Entry)
				{
					still = StillTo1(trans, still, ((Entry)obj).key, depth);
					still = StillTo1(trans, still, ((Entry)obj).value, depth);
				}
				else
				{
					if (depth.Mode().IsDeactivate())
					{
						// Special handling to deactivate .net structs
						ClassMetadata metadata = ClassMetadataForObject(obj);
						if (metadata != null && metadata.IsStruct())
						{
							metadata.ForceDeactivation(trans, depth, obj);
						}
					}
				}
			}
			return still;
		}