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


C# OID类代码示例

本文整理汇总了C#中OID的典型用法代码示例。如果您正苦于以下问题:C# OID类的具体用法?C# OID怎么用?C# OID使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: Execute

        public override void Execute(OID oid, AttributeValuesMap values)
        {
            var candidate = values[AttributeName];

            if (candidate is OID)
            {
                var candidateOid = (OID)candidate;
                candidate = _query.GetQueryEngine().GetObjectFromOid(candidateOid);
            }

            if (!(candidate is IList || candidate is string))
                throw new OdbRuntimeException(
                    NDatabaseError.UnsupportedOperation.AddParameter("Size() with string or collection as the argument"));

            var candidateAsString = candidate as string;
            if (candidateAsString != null)
            {
                _size = candidateAsString.Length;
            }
            else
            {
                var list = (IList)candidate;
                _size = list.Count;    
            }
        }
开发者ID:spolnik,项目名称:ndatabase,代码行数:25,代码来源:SizeAction.cs

示例2: Execute

        public override void Execute(OID oid, AttributeValuesMap values)
        {
            var candidate = values[AttributeName];

            if (candidate is OID)
            {
                var candidateOid = (OID)candidate;
                candidate = _query.GetQueryEngine().GetObjectFromOid(candidateOid);
            }

            var l = ((IEnumerable)candidate).Cast<object>().ToList();
            var localFromIndex = _fromIndex;
            var localEndIndex = _fromIndex + _size;

            // If not throw exception, we must implement 
            // Index Out Of Bound protection
            if (!_throwExceptionIfOutOfBound)
            {
                // Check from index
                if (localFromIndex > l.Count - 1)
                    localFromIndex = 0;

                // Check end index
                if (localEndIndex > l.Count)
                    localEndIndex = l.Count;
            }

            _sublist = new LazySimpleListOfAoi<object>(GetInstanceBuilder(), ReturnInstance());
            var count = localEndIndex - localFromIndex;
            var sublist = l.GetRange(localFromIndex, count);

            _sublist.AddAll(sublist);
        }
开发者ID:SchwarzerLoewe,项目名称:Paint,代码行数:33,代码来源:SublistAction.cs

示例3: InsertNonNativeObject

 /// <param name="oid"> The Oid of the object to be inserted </param>
 /// <param name="nnoi"> The object meta representation The object to be inserted in the database </param>
 /// <param name="isNewObject"> To indicate if object is new </param>
 /// <returns> The position of the inserted object </returns>
 public OID InsertNonNativeObject(OID oid, NonNativeObjectInfo nnoi, bool isNewObject)
 {
     var ci = nnoi.GetClassInfo();
     var @object = nnoi.GetObject();
     // First check if object is already being inserted
     // This method returns -1 if object is not being inserted
     var cachedOid = _session.GetCache().IdOfInsertingObject(@object);
     if (cachedOid != null)
         return cachedOid;
     // Then checks if the class of this object already exist in the
     // meta model
     ci = _objectWriter.AddClass(ci, true);
     // Resets the ClassInfo in the objectInfo to be sure it contains all
     // updated class info data
     nnoi.SetClassInfo(ci);
     // Mark this object as being inserted. To manage cyclic relations
     // The oid may be equal to -1
     // Later in the process the cache will be updated with the right oid
     _session.GetCache().StartInsertingObjectWithOid(@object, oid);
     // false : do not write data in transaction. Data are always written
     // directly to disk. Pointers are written in transaction
     var newOid = WriteNonNativeObjectInfo(oid, nnoi, -1, false, isNewObject);
     if (!Equals(newOid, StorageEngineConstant.NullObjectId))
         _session.GetCache().AddObject(newOid, @object, nnoi.GetHeader());
     
     return newOid;
 }
开发者ID:spolnik,项目名称:ndatabase,代码行数:31,代码来源:NonNativeObjectWriter.cs

示例4: BeforeUpdate

 public override bool BeforeUpdate(IObjectRepresentation oldObjectRepresentation, object newObject, OID oid)
 {
     var so = (SimpleObject) newObject;
     // just add 1
     so.SetId(so.GetId() + 1);
     return true;
 }
开发者ID:danfma,项目名称:NDB,代码行数:7,代码来源:MyUpdateTriggerBefore.cs

示例5: SendActivateItemMessage

 public static void SendActivateItemMessage(OID itemId, long objectId)
 {
     ActivateItemMessage message = new ActivateItemMessage();
     message.ItemId = itemId;
     message.ObjectId = objectId;
     Client.Instance.NetworkHelper.SendMessage(message);
 }
开发者ID:BladeFight,项目名称:EgionOnline,代码行数:7,代码来源:NetworkAPI.cs

示例6: CompareTo

        public override int CompareTo(OID oid)
        {
            if (oid == null || !(oid is ObjectOID))
                return -1000;

            var otherOid = oid;
            return (int) (ObjectId - otherOid.ObjectId);
        }
开发者ID:spolnik,项目名称:ndatabase,代码行数:8,代码来源:ObjectOID.cs

示例7: MatchObjectWithOid

        protected override bool MatchObjectWithOid(OID oid, bool returnObject, bool inMemory)
        {
            CurrentOid = oid;
            var tmpCache = Session.GetTmpCache();
            try
            {
                ObjectInfoHeader objectInfoHeader;

                if (!Query.HasCriteria())
                {
                    // true, false = use cache, false = do not return object
                    // TODO Warning setting true to useCache will put all objects in the cache
                    // This is not a good idea for big queries!, But use cache=true
                    // resolves when object have not been committed yet!
                    // for big queries, user should use a LazyCache!
                    if (inMemory)
                    {
                        CurrentNnoi = ObjectReader.ReadNonNativeObjectInfoFromOid(ClassInfo, CurrentOid, true,
                                                                                  returnObject);
                        if (CurrentNnoi.IsDeletedObject())
                            return false;
                        CurrentOid = CurrentNnoi.GetOid();
                        NextOID = CurrentNnoi.GetNextObjectOID();
                    }
                    else
                    {
                        objectInfoHeader = ObjectReader.ReadObjectInfoHeaderFromOid(CurrentOid, false);
                        NextOID = objectInfoHeader.GetNextObjectOID();
                    }
                    return true;
                }

                // Gets a map with the values with the fields involved in the query
                var attributeValues = ObjectReader.ReadObjectInfoValuesFromOID(ClassInfo, CurrentOid, true,
                                                                               _involvedFields, _involvedFields, 0);

                // Then apply the query on the field values
                var objectMatches = Query.Match(attributeValues);

                if (objectMatches)
                {
                    // Then load the entire object
                    // true, false = use cache
                    CurrentNnoi = ObjectReader.ReadNonNativeObjectInfoFromOid(ClassInfo, CurrentOid, true, returnObject);
                    CurrentOid = CurrentNnoi.GetOid();
                }

                objectInfoHeader = attributeValues.GetObjectInfoHeader();
                // Stores the next position
                NextOID = objectInfoHeader.GetNextObjectOID();
                return objectMatches;
            }
            finally
            {
                tmpCache.ClearObjectInfos();
            }
        }
开发者ID:spolnik,项目名称:ndatabase,代码行数:57,代码来源:CriteriaQueryExecutor.cs

示例8: Execute

        public override void Execute(OID oid, AttributeValuesMap values)
        {
            var number = Convert.ToDecimal(values[AttributeName]);
            var bd = ValuesUtil.Convert(number);
            if (bd.CompareTo(_maxValue) <= 0)
                return;

            _oidOfMaxValues = oid;
            _maxValue = bd;
        }
开发者ID:SchwarzerLoewe,项目名称:Paint,代码行数:10,代码来源:MaxValueAction.cs

示例9: GetObjectInfoByOid

        public NonNativeObjectInfo GetObjectInfoByOid(OID oid)
        {
            if (oid == null)
                throw new OdbRuntimeException(NDatabaseError.CacheNullOid);

            NonNativeObjectInfo value;
            _readingObjectInfo.TryGetValue(oid, out value);

            return value;
        }
开发者ID:SchwarzerLoewe,项目名称:Paint,代码行数:10,代码来源:ReadObjectsCache.cs

示例10: StartReadingObjectInfoWithOid

        public void StartReadingObjectInfoWithOid(OID oid, NonNativeObjectInfo objectInfo)
        {
            if (oid == null)
                throw new OdbRuntimeException(NDatabaseError.CacheNullOid);

            NonNativeObjectInfo nnoi;
            var success = _readingObjectInfo.TryGetValue(oid, out nnoi);

            if (!success)
                _readingObjectInfo[oid] = objectInfo;
        }
开发者ID:SchwarzerLoewe,项目名称:Paint,代码行数:11,代码来源:ReadObjectsCache.cs

示例11: Execute

        public override void Execute(OID oid, AttributeValuesMap values)
        {
            _value = values[AttributeName];
            if (!(_value is ICollection || IsGenericCollection(_value.GetType())))
                return;

            // For collection,we encapsulate it in an lazy load list that will create objects on demand
            var c = ((IEnumerable) _value).Cast<object>().ToList();
            var l = new LazySimpleListOfAoi<object>(GetInstanceBuilder(), ReturnInstance());
            l.AddRange(c);
            _value = l;
        }
开发者ID:SchwarzerLoewe,项目名称:Paint,代码行数:12,代码来源:FieldValueAction.cs

示例12: AfterSelect

        public override void AfterSelect(object @object, OID oid)
        {
            var type = @object.GetType();
            var oidField = OidFields.GetOrAdd(type, SearchOidSupportableField);

            if (oidField == null)
                return;

            if (oidField.FieldType == typeof (OID))
                oidField.SetValue(@object, oid);
            else
                oidField.SetValue(@object, oid.ObjectId);
        }
开发者ID:SchwarzerLoewe,项目名称:Paint,代码行数:13,代码来源:EnrichWithOidTrigger.cs

示例13: AddObject

		public virtual void AddObject(object o, OID oid)
		{
			if (o == null)
			{
				return;
			}
			// throw new
			// ODBRuntimeException(NeoDatisError.CACHE_NULL_OBJECT.addParameter(object));
			try
			{
				objects.Add(o, oid);
			}
			catch (System.ArgumentNullException)
			{
			}
		}
开发者ID:Orvid,项目名称:SQLInterfaceCollection,代码行数:16,代码来源:CrossSessionCache.cs

示例14: IdManager

        /// <param name="objectWriter"> The object writer </param>
        /// <param name="objectReader"> The object reader </param>
        /// <param name="currentIdBlock">Current Id block data </param>
        public IdManager(IObjectWriter objectWriter, IObjectReader objectReader, CurrentIdBlockInfo currentIdBlock)
        {
            _objectWriter = objectWriter;
            _objectReader = objectReader;
            _currentBlockIdPosition = currentIdBlock.CurrentIdBlockPosition;
            _currentBlockIdNumber = currentIdBlock.CurrentIdBlockNumber;
            _maxId = new ObjectOID((long)currentIdBlock.CurrentIdBlockNumber * StorageEngineConstant.NbIdsPerBlock);
            _nextId = new ObjectOID(currentIdBlock.CurrentIdBlockMaxOid.ObjectId + 1);

            _lastIds = new OID[IdBufferSize];
            for (var i = 0; i < IdBufferSize; i++)
                _lastIds[i] = StorageEngineConstant.NullObjectId;

            _lastIdPositions = new long[IdBufferSize];
            _lastIdIndex = 0;
        }
开发者ID:spolnik,项目名称:ndatabase,代码行数:19,代码来源:IdManager.cs

示例15: SetParent

        public override void SetParent(IBTreeNode node)
        {
            _parent = node;

            if (_parent != null)
            {
                if (_parent.GetId() == null)
                    Btree.GetPersister().SaveNode(_parent);

                _parentOid = (OID) _parent.GetId();
            }
            else
            {
                _parentOid = null;
            }
        }
开发者ID:spolnik,项目名称:ndatabase,代码行数:16,代码来源:ODBBTreeNodeSingle.cs


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