本文整理汇总了C#中IExtObjectContainer.GetID方法的典型用法代码示例。如果您正苦于以下问题:C# IExtObjectContainer.GetID方法的具体用法?C# IExtObjectContainer.GetID怎么用?C# IExtObjectContainer.GetID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IExtObjectContainer
的用法示例。
在下文中一共展示了IExtObjectContainer.GetID方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Conc
public virtual void Conc(IExtObjectContainer oc)
{
IQuery q = oc.Query();
q.Constrain(this.GetType());
IObjectSet res = q.Execute();
Assert.AreEqual(Count, res.Count);
long[] ids1 = new long[res.Count];
int i = 0;
while (res.HasNext())
{
ids1[i++] = oc.GetID(res.Next());
}
res.Reset();
long[] ids2 = res.Ext().GetIDs();
Assert.AreEqual(Count, ids1.Length);
Assert.AreEqual(Count, ids2.Length);
for (int j = 0; j < ids1.Length; j++)
{
bool found = false;
for (int k = 0; k < ids2.Length; k++)
{
if (ids1[j] == ids2[k])
{
found = true;
break;
}
}
Assert.IsTrue(found);
}
}
示例2: SlotHandlerVersion
public static int SlotHandlerVersion(IExtObjectContainer objectContainer, object
obj)
{
int id = (int)objectContainer.GetID(obj);
IObjectInfo objectInfo = objectContainer.GetObjectInfo(obj);
ObjectContainerBase container = (ObjectContainerBase)objectContainer;
Transaction trans = container.Transaction;
ByteArrayBuffer buffer = container.ReadBufferById(trans, id);
UnmarshallingContext context = new UnmarshallingContext(trans, (ObjectReference)objectInfo
, Const4.Transient, false);
context.Buffer(buffer);
context.PersistentObject(obj);
context.ActivationDepth(new LegacyActivationDepth(0));
context.Read();
return context.HandlerVersion();
}
示例3: Conc
public virtual void Conc(IExtObjectContainer oc)
{
ExtMethodsTestCase em = new ExtMethodsTestCase();
oc.Store(em);
Assert.IsFalse(oc.IsClosed());
Assert.IsTrue(oc.IsActive(em));
Assert.IsTrue(oc.IsStored(em));
oc.Deactivate(em, 1);
Assert.IsTrue(!oc.IsActive(em));
oc.Activate(em, 1);
Assert.IsTrue(oc.IsActive(em));
long id = oc.GetID(em);
Assert.IsTrue(oc.IsCached(id));
oc.Purge(em);
Assert.IsFalse(oc.IsCached(id));
Assert.IsFalse(oc.IsStored(em));
Assert.IsFalse(oc.IsActive(em));
oc.Bind(em, id);
Assert.IsTrue(oc.IsCached(id));
Assert.IsTrue(oc.IsStored(em));
Assert.IsTrue(oc.IsActive(em));
ExtMethodsTestCase em2 = (ExtMethodsTestCase)oc.GetByID(id);
Assert.AreSame(em, em2);
// Purge all and try again
oc.Purge();
Assert.IsTrue(oc.IsCached(id));
Assert.IsTrue(oc.IsStored(em));
Assert.IsTrue(oc.IsActive(em));
em2 = (ExtMethodsTestCase)oc.GetByID(id);
Assert.AreSame(em, em2);
oc.Delete(em2);
oc.Commit();
Assert.IsFalse(oc.IsCached(id));
Assert.IsFalse(oc.IsStored(em2));
Assert.IsFalse(oc.IsActive(em2));
// Null checks
Assert.IsFalse(oc.IsStored(null));
Assert.IsFalse(oc.IsActive(null));
Assert.IsFalse(oc.IsCached(0));
}
示例4: AssertInstanceCountAndFieldIndexes
private void AssertInstanceCountAndFieldIndexes(IExtObjectContainer client1)
{
CsCascadedDeleteReaddChildReferenceTestCase.ItemParent parent3 = ((CsCascadedDeleteReaddChildReferenceTestCase.ItemParent
)RetrieveOnlyInstance(client1, typeof(CsCascadedDeleteReaddChildReferenceTestCase.ItemParent
)));
RetrieveOnlyInstance(client1, typeof(CsCascadedDeleteReaddChildReferenceTestCase.Item
));
client1.Refresh(parent3, int.MaxValue);
long parentIdAfterUpdate = client1.GetID(parent3);
long childIdAfterUpdate = client1.GetID(parent3.child);
new FieldIndexAssert(typeof(CsCascadedDeleteReaddChildReferenceTestCase.ItemParent
), "child").AssertSingleEntry(FileSession(), parentIdAfterUpdate);
new FieldIndexAssert(typeof(CsCascadedDeleteReaddChildReferenceTestCase.Item), "name"
).AssertSingleEntry(FileSession(), childIdAfterUpdate);
}
示例5: AssertInstanceCountAndFieldIndexes
private void AssertInstanceCountAndFieldIndexes(IExtObjectContainer client1)
{
var parent3 = ((ItemParent
) RetrieveOnlyInstance(client1, typeof (ItemParent
)));
RetrieveOnlyInstance(client1, typeof (Item
));
client1.Refresh(parent3, int.MaxValue);
var parentIdAfterUpdate = client1.GetID(parent3);
var childIdAfterUpdate = client1.GetID(parent3.child);
new FieldIndexAssert(typeof (ItemParent
), "child").AssertSingleEntry(FileSession(), parentIdAfterUpdate);
new FieldIndexAssert(typeof (Item), "name"
).AssertSingleEntry(FileSession(), childIdAfterUpdate);
}