当前位置: 首页>>代码示例>>C#>>正文


C# Transaction.ReferenceForObject方法代码示例

本文整理汇总了C#中Db4objects.Db4o.Internal.Transaction.ReferenceForObject方法的典型用法代码示例。如果您正苦于以下问题:C# Transaction.ReferenceForObject方法的具体用法?C# Transaction.ReferenceForObject怎么用?C# Transaction.ReferenceForObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Db4objects.Db4o.Internal.Transaction的用法示例。


在下文中一共展示了Transaction.ReferenceForObject方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Analyze

		internal virtual void Analyze(Transaction trans)
		{
			_ref = trans.ReferenceForObject(_obj);
			if (_ref != null)
			{
				_classMetadata = _ref.ClassMetadata();
				return;
			}
			IReflectClass claxx = _container.Reflector().ForObject(_obj);
			if (claxx == null)
			{
				NotStorable(_obj, claxx);
				return;
			}
			if (!DetectClassMetadata(trans, claxx))
			{
				return;
			}
			if (IsValueType(_classMetadata))
			{
				NotStorable(_obj, _classMetadata.ClassReflector());
			}
		}
开发者ID:bvangrinsven,项目名称:db4o-net,代码行数:23,代码来源:ObjectAnalyzer.cs

示例2: DetectClassMetadata

		private bool DetectClassMetadata(Transaction trans, IReflectClass claxx)
		{
			_classMetadata = _container.GetActiveClassMetadata(claxx);
			if (_classMetadata != null)
			{
				if (!_classMetadata.IsStorable())
				{
					NotStorable(_obj, claxx);
					return false;
				}
				return true;
			}
			_classMetadata = _container.ProduceClassMetadata(claxx);
			if (_classMetadata == null || !_classMetadata.IsStorable())
			{
				NotStorable(_obj, claxx);
				return false;
			}
			// The following may return a reference if the object is held
			// in a static variable somewhere ( often: Enums) that gets
			// stored or associated on initialization of the ClassMetadata.
			_ref = trans.ReferenceForObject(_obj);
			return true;
		}
开发者ID:bvangrinsven,项目名称:db4o-net,代码行数:24,代码来源:ObjectAnalyzer.cs

示例3: Descend

		internal virtual object Descend(Transaction trans, object obj, string[] path)
		{
			lock (_lock)
			{
				trans = CheckTransaction(trans);
				ObjectReference @ref = trans.ReferenceForObject(obj);
				if (@ref == null)
				{
					return null;
				}
				string fieldName = path[0];
				if (fieldName == null)
				{
					return null;
				}
				ClassMetadata classMetadata = @ref.ClassMetadata();
				ByRef foundField = new ByRef();
				classMetadata.TraverseAllAspects(new _TraverseFieldCommand_693(fieldName, foundField
					));
				FieldMetadata field = (FieldMetadata)foundField.value;
				if (field == null)
				{
					return null;
				}
				object child = @ref.IsActive() ? field.Get(trans, obj) : DescendMarshallingContext
					(trans, @ref).ReadFieldValue(field);
				if (path.Length == 1)
				{
					return child;
				}
				if (child == null)
				{
					return null;
				}
				string[] subPath = new string[path.Length - 1];
				System.Array.Copy(path, 1, subPath, 0, path.Length - 1);
				return Descend(trans, child, subPath);
			}
		}
开发者ID:erdincay,项目名称:db4o,代码行数:39,代码来源:ObjectContainerBase.cs

示例4: Delete1

		public void Delete1(Transaction trans, object obj, bool userCall)
		{
			if (obj == null)
			{
				return;
			}
			ObjectReference @ref = trans.ReferenceForObject(obj);
			if (@ref == null)
			{
				return;
			}
			if (userCall)
			{
				GenerateCallIDOnTopLevel();
			}
			AsTopLevelCall(new _IFunction4_565(this, @ref, obj, userCall), trans);
		}
开发者ID:erdincay,项目名称:db4o,代码行数:17,代码来源:ObjectContainerBase.cs

示例5: Db4oTypeStored

		/// <summary>allows special handling for all Db4oType objects.</summary>
		/// <remarks>
		/// allows special handling for all Db4oType objects.
		/// Redirected here from #set() so only instanceof check is necessary
		/// in the #set() method.
		/// </remarks>
		/// <returns>object if handled here and #set() should not continue processing</returns>
		public virtual IDb4oType Db4oTypeStored(Transaction trans, object obj)
		{
			if (!(obj is Db4oDatabase))
			{
				return null;
			}
			Db4oDatabase database = (Db4oDatabase)obj;
			if (trans.ReferenceForObject(obj) != null)
			{
				return database;
			}
			ShowInternalClasses(true);
			try
			{
				return database.Query(trans);
			}
			finally
			{
				ShowInternalClasses(false);
			}
		}
开发者ID:erdincay,项目名称:db4o,代码行数:28,代码来源:ObjectContainerBase.cs

示例6: StillTo1

		// 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;
		}
开发者ID:erdincay,项目名称:db4o,代码行数:59,代码来源:ObjectContainerBase.cs

示例7: IsStored

		public bool IsStored(Transaction trans, object obj)
		{
			lock (_lock)
			{
				trans = CheckTransaction(trans);
				if (obj == null)
				{
					return false;
				}
				ObjectReference @ref = trans.ReferenceForObject(obj);
				if (@ref == null)
				{
					return false;
				}
				return !IsDeleted(trans, @ref.GetID());
			}
		}
开发者ID:erdincay,项目名称:db4o,代码行数:17,代码来源:ObjectContainerBase.cs

示例8: IsActive

		internal bool IsActive(Transaction trans, object obj)
		{
			lock (_lock)
			{
				trans = CheckTransaction(trans);
				if (obj != null)
				{
					ObjectReference @ref = trans.ReferenceForObject(obj);
					if (@ref != null)
					{
						return @ref.IsActive();
					}
				}
				return false;
			}
		}
开发者ID:erdincay,项目名称:db4o,代码行数:16,代码来源:ObjectContainerBase.cs

示例9: GetObjectInfo

		public IObjectInfo GetObjectInfo(Transaction trans, object obj)
		{
			lock (_lock)
			{
				trans = CheckTransaction(trans);
				return trans.ReferenceForObject(obj);
			}
		}
开发者ID:erdincay,项目名称:db4o,代码行数:8,代码来源:ObjectContainerBase.cs

示例10: GetID

		public int GetID(Transaction trans, object obj)
		{
			lock (_lock)
			{
				trans = CheckTransaction(trans);
				CheckClosed();
				if (obj == null)
				{
					return 0;
				}
				ObjectReference yo = trans.ReferenceForObject(obj);
				if (yo != null)
				{
					return yo.GetID();
				}
				return 0;
			}
		}
开发者ID:erdincay,项目名称:db4o,代码行数:18,代码来源:ObjectContainerBase.cs

示例11: Get

		public object Get(Transaction trans, object onObject)
		{
			if (_containingClass == null)
			{
				return null;
			}
			ObjectContainerBase container = Container();
			if (container == null)
			{
				return null;
			}
			lock (container.Lock())
			{
				// FIXME: The following is not really transactional.
				//        This will work OK for normal C/S and for
				//        single local mode but the transaction will
				//        be wrong for MTOC.
				if (trans == null)
				{
					trans = container.Transaction;
				}
				container.CheckClosed();
				ObjectReference @ref = trans.ReferenceForObject(onObject);
				if (@ref == null)
				{
					return null;
				}
				int id = @ref.GetID();
				if (id <= 0)
				{
					return null;
				}
				UnmarshallingContext context = new UnmarshallingContext(trans, @ref, Const4.AddToIdTree
					, false);
				context.ActivationDepth(new LegacyActivationDepth(1));
				return context.ReadFieldValue(this);
			}
		}
开发者ID:Orvid,项目名称:SQLInterfaceCollection,代码行数:38,代码来源:FieldMetadata.cs


注:本文中的Db4objects.Db4o.Internal.Transaction.ReferenceForObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。