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


C# NeoDatis.GetAttributeValueFromId方法代码示例

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


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

示例1: BuildIndexKey

		public static NeoDatis.Tool.Wrappers.OdbComparable BuildIndexKey(string indexName
			, NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo oi, int[] fieldIds)
		{
			NeoDatis.Tool.Wrappers.OdbComparable[] keys = new NeoDatis.Tool.Wrappers.OdbComparable
				[fieldIds.Length];
			NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo aoi = null;
			System.IComparable o = null;
			for (int i = 0; i < fieldIds.Length; i++)
			{
				// Todo : can we assume that the object is a Comparable
				try
				{
					aoi = (NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo)oi.GetAttributeValueFromId
						(fieldIds[i]);
					o = (System.IComparable)aoi.GetObject();
					// JDK1.4 restriction: Boolean is not Comparable in jdk1.4
					if (aoi.GetOdbType().IsBoolean())
					{
						bool b = (bool)o;
						if (b)
						{
							o = (byte)1;
						}
						else
						{
							o = (byte)0;
						}
					}
					// If the index is on NonNativeObjectInfo, then the key is the oid 
					// of the object
					if (aoi.IsNonNativeObject())
					{
						NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo nnoi = (NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
							)aoi;
						o = nnoi.GetOid();
					}
					keys[i] = new NeoDatis.Odb.Core.Query.SimpleCompareKey(o);
				}
				catch (System.Exception)
				{
					throw new NeoDatis.Odb.ODBRuntimeException(NeoDatis.Odb.Core.NeoDatisError.IndexKeysMustImplementComparable
						.AddParameter(fieldIds[i]).AddParameter(oi.GetAttributeValueFromId(fieldIds[i]).
						GetType().FullName));
				}
			}
			if (keys.Length == 1)
			{
				return keys[0];
			}
			return new NeoDatis.Odb.Core.Query.ComposedCompareKey(keys);
		}
开发者ID:Orvid,项目名称:SQLInterfaceCollection,代码行数:51,代码来源:IndexTool.cs

示例2: WriteNonNativeObjectInfo


//.........这里部分代码省略.........
			// The positions that is going to be written are 'int' representing
			// the offset position of the attribute
			// first write the number of attributes
			// fsi.writeInt(nbAttributes, writeDataInTransaction, "nb attr");
			byteArrayConverter.IntToByteArray(nbAttributes, bytes, 66);
			// Then write the array of bytes
			fsi.WriteBytes(bytes, writeDataInTransaction, "NonNativeObjectInfoHeader");
			// Store the position
			long attributePositionStart = fsi.GetPosition();
			int attributeSize = NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType.SizeOfInt + NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType
				.SizeOfLong;
			byte[] abytes = new byte[nbAttributes * (attributeSize)];
			// here, just write an empty (0) array, as real values will be set at
			// the end
			fsi.WriteBytes(abytes, writeDataInTransaction, "Empty Attributes");
			long[] attributesIdentification = new long[nbAttributes];
			int[] attributeIds = new int[nbAttributes];
			// Puts the object info in the cache
			// storageEngine.getSession().getCache().addObject(position,
			// aoi.getObject(), objectInfo.getHeader());
			NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassAttributeInfo cai = null;
			NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo aoi2 = null;
			long nativeAttributePosition = -1;
			NeoDatis.Odb.OID nonNativeAttributeOid = null;
			long maxWritePosition = fsi.GetPosition();
			// Loop on all attributes
			for (int i = 0; i < nbAttributes; i++)
			{
				// Gets the attribute meta description
				cai = classInfo.GetAttributeInfo(i);
				// Gets the id of the attribute
				attributeIds[i] = cai.GetId();
				// Gets the attribute data
				aoi2 = objectInfo.GetAttributeValueFromId(cai.GetId());
				if (aoi2 == null)
				{
					// This only happens in 1 case : when a class has a field with
					// the same name of one of is superclass. In this, the deeper
					// attribute is null
					if (cai.IsNative())
					{
						aoi2 = new NeoDatis.Odb.Core.Layers.Layer2.Meta.NullNativeObjectInfo(cai.GetAttributeType
							().GetId());
					}
					else
					{
						aoi2 = new NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeNullObjectInfo(cai.GetClassInfo
							());
					}
				}
				if (aoi2.IsNative())
				{
					nativeAttributePosition = InternalStoreObject((NeoDatis.Odb.Core.Layers.Layer2.Meta.NativeObjectInfo
						)aoi2);
					// For native objects , odb stores their position
					attributesIdentification[i] = nativeAttributePosition;
				}
				else
				{
					if (aoi2.IsObjectReference())
					{
						NeoDatis.Odb.Core.Layers.Layer2.Meta.ObjectReference or = (NeoDatis.Odb.Core.Layers.Layer2.Meta.ObjectReference
							)aoi2;
						nonNativeAttributeOid = or.GetOid();
					}
					else
开发者ID:Orvid,项目名称:SQLInterfaceCollection,代码行数:67,代码来源:AbstractObjectWriter.cs


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