本文整理汇总了C#中OID类的典型用法代码示例。如果您正苦于以下问题:C# OID类的具体用法?C# OID怎么用?C# OID使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OID类属于命名空间,在下文中一共展示了OID类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: MatchObjectWithOid
protected override bool MatchObjectWithOid(OID oid, bool returnObject, bool inMemory)
{
CurrentOid = oid;
// Gets a map with the values with the fields involved in the query
_values = ObjectReader.ReadObjectInfoValuesFromOID(ClassInfo, CurrentOid, true, _involvedFields,
_involvedFields, 0);
var objectMatches = true;
if (!_sodaQuery.IsForSingleOid())
{
// Then apply the query on the field values
objectMatches = _sodaQuery.Match(_values);
}
var objectInfoHeader = _values.GetObjectInfoHeader();
// Stores the next position
NextOID = objectInfoHeader.GetNextObjectOID();
return objectMatches;
}
开发者ID:SchwarzerLoewe,项目名称:Paint,代码行数:20,代码来源:ValuesCriteriaQueryExecutor.cs
示例17: T1estC1
public virtual void T1estC1()
{
test.DeleteBase("acid1");
simpleObject = true;
using (var odb = test.Open("acid1"))
{
var size = 5;
var oids = new OID[size];
for (var i = 0; i < size; i++)
oids[i] = odb.Store(GetInstance("f" + i));
for (var i = 0; i < size; i++)
odb.DeleteObjectWithId(oids[i]);
}
using (var odb = test.Open("acid1"))
{
var query = odb.Query<VO.Login.Function>();
AssertEquals(0, query.Execute<VO.Login.Function>().Count);
}
}
开发者ID:danfma,项目名称:NDB,代码行数:22,代码来源:TestStopEngineWithoutCommit.cs
示例18: _HandleQuestProgressInfo
void _HandleQuestProgressInfo(Dictionary<string, object> props)
{
/// update the information about the quests in progress from this npc
questsInProgress.Clear ();
int numQuests = (int)props ["numQuests"];
npcID = (OID)props ["npcID"];
for (int i = 0; i < numQuests; i++) {
QuestLogEntry logEntry = new QuestLogEntry ();
questsInProgress.Add (logEntry);
logEntry.Title = (string)props ["title" + i];
logEntry.QuestId = (OID)props ["questID" + i];
logEntry.NpcId = npcID;
//logEntry.Description = (string)props ["description" + i];
logEntry.ProgressText = (string)props ["progress" + i];
logEntry.Complete = (bool)props ["complete" + i];
logEntry.Objective = (string)props ["objective" + i];
logEntry.gradeCount = (int)props ["grades" + i];
logEntry.gradeInfo = new List<QuestGradeEntry> ();
//ClientAPI.Write("Quest grades: %s" % logEntry.grades)
for (int j = 0; j < (logEntry.gradeCount + 1); j++) {
QuestGradeEntry gradeEntry = new QuestGradeEntry ();
List<QuestRewardEntry> gradeRewards = new List<QuestRewardEntry> ();
int numRewards = (int)props ["rewards" + i + " " + j];
for (int k = 0; k < numRewards; k++) {
//id, name, icon, count = item;
QuestRewardEntry entry = new QuestRewardEntry ();
entry.id = (int)props ["rewards" + i + "_" + j + "_" + k];
AtavismInventoryItem item = gameObject.GetComponent<Inventory> ().GetItemByTemplateID (entry.id);
entry.name = item.name;
entry.icon = item.icon;
entry.count = (int)props ["rewards" + i + "_" + j + "_" + k + "Count"];
gradeRewards.Add (entry);
//ClientAPI.Write("Reward: %s" % entry)
}
gradeEntry.rewardItems = gradeRewards;
// Items to choose from
List<QuestRewardEntry> gradeRewardsToChoose = new List<QuestRewardEntry> ();
numRewards = (int)props ["rewardsToChoose" + i + " " + j];
for (int k = 0; k < numRewards; k++) {
//id, name, icon, count = item;
QuestRewardEntry entry = new QuestRewardEntry ();
entry.id = (int)props ["rewardsToChoose" + i + "_" + j + "_" + k];
AtavismInventoryItem item = gameObject.GetComponent<Inventory> ().GetItemByTemplateID (entry.id);
entry.name = item.name;
entry.icon = item.icon;
entry.count = (int)props ["rewardsToChoose" + i + "_" + j + "_" + k + "Count"];
gradeRewardsToChoose.Add (entry);
//ClientAPI.Write("Reward to choose: %s" % entry)
}
gradeEntry.RewardItemsToChoose = gradeRewardsToChoose;
gradeEntry.completionText = (string)props ["completion" + i + "_" + j];
logEntry.gradeInfo.Add (gradeEntry);
}
}
//
// dispatch a ui event to tell the rest of the system
//
gameObject.GetComponent<NpcInteraction> ().NpcId = npcID;
string[] args = new string[1];
AtavismEventSystem.DispatchEvent ("QUEST_PROGRESS_UPDATE", args);
}
开发者ID:zukeru,项目名称:ageofasura,代码行数:61,代码来源:Quests.cs
示例19: _HandleQuestOfferResponse
void _HandleQuestOfferResponse(Dictionary<string, object> props)
{
// update the information about the quests on offer from this npc
questsOffered.Clear ();
int numQuests = (int)props ["numQuests"];
npcID = (OID)props ["npcID"];
for (int i = 0; i < numQuests; i++) {
QuestLogEntry logEntry = new QuestLogEntry ();
questsOffered.Add (logEntry);
logEntry.Title = (string)props ["title" + i];
logEntry.QuestId = (OID)props ["questID" + i];
logEntry.NpcId = npcID;
logEntry.Description = (string)props ["description" + i];
logEntry.Objective = (string)props ["objective" + i];
//logEntry.Objectives.Clear ();
//LinkedList<string> objectives = (LinkedList<string>)props ["objectives"];
//foreach (string objective in objectives)
// logEntry.Objectives.Add (objective);
logEntry.gradeCount = (int)props ["grades" + i];
logEntry.gradeInfo = new List<QuestGradeEntry> ();
//ClientAPI.Write("Quest grades: %s" % logEntry.grades)
for (int j = 0; j < (logEntry.gradeCount + 1); j++) {
QuestGradeEntry gradeEntry = new QuestGradeEntry ();
List<QuestRewardEntry> gradeRewards = new List<QuestRewardEntry> ();
int numRewards = (int)props ["rewards" + i + " " + j];
for (int k = 0; k < numRewards; k++) {
//id, name, icon, count = item;
QuestRewardEntry entry = new QuestRewardEntry ();
entry.id = (int)props ["rewards" + i + "_" + j + "_" + k];
AtavismInventoryItem item = gameObject.GetComponent<Inventory> ().GetItemByTemplateID (entry.id);
if (item != null) {
entry.name = item.name;
entry.icon = item.icon;
}
entry.count = (int)props ["rewards" + i + "_" + j + "_" + k + "Count"];
gradeRewards.Add (entry);
//ClientAPI.Write("Reward: %s" % entry)
}
gradeEntry.rewardItems = gradeRewards;
// Items to choose from
List<QuestRewardEntry> gradeRewardsToChoose = new List<QuestRewardEntry> ();
numRewards = (int)props ["rewardsToChoose" + i + " " + j];
for (int k = 0; k < numRewards; k++) {
//id, name, icon, count = item;
QuestRewardEntry entry = new QuestRewardEntry ();
entry.id = (int)props ["rewardsToChoose" + i + "_" + j + "_" + k];
AtavismInventoryItem item = gameObject.GetComponent<Inventory> ().GetItemByTemplateID (entry.id);
if (item != null) {
entry.name = item.name;
entry.icon = item.icon;
}
entry.count = (int)props ["rewardsToChoose" + i + "_" + j + "_" + k + "Count"];
gradeRewardsToChoose.Add (entry);
//ClientAPI.Write("Reward to choose: %s" % entry)
}
gradeEntry.RewardItemsToChoose = gradeRewardsToChoose;
logEntry.gradeInfo.Add (gradeEntry);
}
}
// dispatch a ui event to tell the rest of the system
gameObject.GetComponent<NpcInteraction> ().NpcId = npcID;
string[] args = new string[1];
AtavismEventSystem.DispatchEvent ("QUEST_OFFERED_UPDATE", args);
}
开发者ID:zukeru,项目名称:ageofasura,代码行数:64,代码来源:Quests.cs
示例20: SetPreviousObjectOID
public void SetPreviousObjectOID(OID previousObjectOID)
{
_previousObjectOID = previousObjectOID;
}
开发者ID:SchwarzerLoewe,项目名称:Paint,代码行数:4,代码来源:ObjectInfoHeader.cs
注:本文中的OID类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论