本文整理汇总了C#中IExtObjectContainer.Delete方法的典型用法代码示例。如果您正苦于以下问题:C# IExtObjectContainer.Delete方法的具体用法?C# IExtObjectContainer.Delete怎么用?C# IExtObjectContainer.Delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IExtObjectContainer
的用法示例。
在下文中一共展示了IExtObjectContainer.Delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Conc
/// <exception cref="System.Exception"></exception>
public virtual void Conc(IExtObjectContainer oc)
{
IObjectSet os = oc.Query(typeof(InvalidUUIDTestCase));
if (os.Count == 0)
{
// already deleted by other threads
return;
}
Assert.AreEqual(1, os.Count);
InvalidUUIDTestCase iu = (InvalidUUIDTestCase)os.Next();
Db4oUUID myUuid = oc.GetObjectInfo(iu).GetUUID();
Assert.IsNotNull(myUuid);
byte[] mySignature = myUuid.GetSignaturePart();
long myLong = myUuid.GetLongPart();
long unknownLong = long.MaxValue - 100;
byte[] unknownSignature = new byte[] { 1, 2, 4, 99, 33, 22 };
Db4oUUID unknownLongPart = new Db4oUUID(unknownLong, mySignature);
Db4oUUID unknownSignaturePart = new Db4oUUID(myLong, unknownSignature);
Db4oUUID unknownBoth = new Db4oUUID(unknownLong, unknownSignature);
Assert.IsNull(oc.GetByUUID(unknownLongPart));
Assert.IsNull(oc.GetByUUID(unknownSignaturePart));
Assert.IsNull(oc.GetByUUID(unknownBoth));
Assert.IsNull(oc.GetByUUID(unknownLongPart));
Thread.Sleep(500);
oc.Delete(iu);
oc.Commit();
Assert.IsNull(oc.GetByUUID(myUuid));
}
示例2: Conc
public virtual void Conc(IExtObjectContainer oc)
{
IsStoredTestCase isStored = new IsStoredTestCase();
isStored.myString = "isStored";
oc.Store(isStored);
Assert.IsTrue(oc.IsStored(isStored));
oc.Commit();
oc.Delete(isStored);
Assert.IsFalse(oc.IsStored(isStored));
oc.Rollback();
Assert.IsTrue(oc.IsStored(isStored));
oc.Delete(isStored);
Assert.IsFalse(oc.IsStored(isStored));
oc.Commit();
Assert.IsFalse(oc.IsStored(isStored));
}
示例3: AssertObjectsAreReadable
protected override void AssertObjectsAreReadable(IExtObjectContainer objectContainer
)
{
CascadedDeleteFileFormatUpdateTestCase.ParentItem parentItem = (CascadedDeleteFileFormatUpdateTestCase.ParentItem
)RetrieveInstance(objectContainer, typeof(CascadedDeleteFileFormatUpdateTestCase.ParentItem
));
Assert.IsNotNull(parentItem._children);
Assert.IsNotNull(parentItem._children[0]);
Assert.IsNotNull(parentItem._children[1]);
objectContainer.Delete(parentItem);
Assert.IsFalse(_failed);
objectContainer.Store(CascadedDeleteFileFormatUpdateTestCase.ParentItem.NewTestInstance
());
}
示例4: AssertObjectsAreReadable
protected override void AssertObjectsAreReadable(IExtObjectContainer objectContainer
)
{
var parentItem = (ParentItem
) RetrieveInstance(objectContainer, typeof (ParentItem
));
Assert.IsNotNull(parentItem._children);
Assert.IsNotNull(parentItem._children[0]);
Assert.IsNotNull(parentItem._children[1]);
objectContainer.Delete(parentItem);
Assert.IsFalse(_failed);
objectContainer.Store(ParentItem.NewTestInstance
());
}
示例5: 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));
}
示例6: ConcDelete
/// <exception cref="System.Exception"></exception>
public virtual void ConcDelete(IExtObjectContainer oc)
{
var os = oc.Query(typeof (Item));
if (os.Count == 0)
{
// the object has been deleted
return;
}
if (!os.HasNext())
{
// object can be deleted after query
return;
}
var cdf = (Item) os.Next();
// sleep 1000 ms, waiting for other threads.
// Thread.sleep(500);
oc.Delete(cdf);
oc.Commit();
AssertOccurrences(oc, typeof (Item), 0);
AssertOccurrences(oc, typeof (CascadeDeleteFalseHelper)
, 1);
}
示例7: Conc
/// <exception cref="System.Exception"></exception>
public virtual void Conc(IExtObjectContainer oc)
{
IQuery q = oc.Query();
q.Constrain(typeof(MultiDeleteTestCase));
q.Descend("name").Constrain("killmefirst");
IObjectSet objectSet = q.Execute();
if (objectSet.Count == 0)
{
// already deleted by other threads
return;
}
Assert.AreEqual(1, objectSet.Count);
Thread.Sleep(1000);
if (!objectSet.HasNext())
{
return;
}
MultiDeleteTestCase md = (MultiDeleteTestCase)objectSet.Next();
oc.Delete(md);
oc.Commit();
AssertOccurrences(oc, typeof(MultiDeleteTestCase), 0);
}
示例8: Conc
/// <exception cref="System.Exception"></exception>
public virtual void Conc(IExtObjectContainer oc)
{
IQuery q = oc.Query();
q.Constrain(typeof(DeleteDeepTestCase));
q.Descend("name").Constrain("root");
IObjectSet os = q.Execute();
if (os.Count == 0)
{
// already deleted
return;
}
Assert.AreEqual(1, os.Count);
if (!os.HasNext())
{
return;
}
DeleteDeepTestCase root = (DeleteDeepTestCase)os.Next();
// wait for other threads
// Thread.sleep(500);
oc.Delete(root);
oc.Commit();
AssertOccurrences(oc, typeof(DeleteDeepTestCase), 0);
}
示例9: AssertObjectsAreReadable
protected override void AssertObjectsAreReadable(IExtObjectContainer objectContainer
)
{
IObjectSet objectSet = objectContainer.Query(typeof(FreespaceManagerMigrationTestCase.StClass
));
for (int i = 0; i < 2; i++)
{
FreespaceManagerMigrationTestCase.StClass cls = (FreespaceManagerMigrationTestCase.StClass
)objectSet.Next();
ArrayList v = cls.GetVect();
int[][] intArray = (int[][])v[0];
ArrayAssert.AreEqual(IntArrayData[0], intArray[0]);
ArrayAssert.AreEqual(IntArrayData[1], intArray[1]);
string[][] stringArray = (string[][])v[1];
ArrayAssert.AreEqual(StringArrayData[0], stringArray[0]);
ArrayAssert.AreEqual(StringArrayData[1], stringArray[1]);
objectContainer.Delete(cls);
}
}
示例10: AssertObjectDeletion
protected override void AssertObjectDeletion(IExtObjectContainer objectContainer)
{
DeletionUponFormatMigrationTestCase.Item item = ItemById(objectContainer, IdToBeDeleted
);
Assert.IsNotNull(item._child);
Assert.IsNotNull(item._array[0]);
objectContainer.Delete(item);
}
示例11: ConcDelete
/// <exception cref="System.Exception"></exception>
public virtual void ConcDelete(IExtObjectContainer oc, int seq)
{
IObjectSet os = oc.Query(typeof(CascadeToVectorTestCase));
if (os.Count == 0)
{
// already deleted
return;
}
Assert.AreEqual(1, os.Count);
CascadeToVectorTestCase ctv = (CascadeToVectorTestCase)os.Next();
// wait for other threads
Thread.Sleep(500);
oc.Delete(ctv);
}
示例12: TTwoRef
private void TTwoRef(IExtObjectContainer oc, string name)
{
var commit = name.IndexOf("commit") > 1;
var delete = name.IndexOf("delete") > 1;
var q = oc.Query();
q.Constrain(typeof (Item));
q.Descend("name").Constrain(name);
var objectSet = q.Execute();
var item1 = (Item) objectSet
.Next();
var item2 = (Item) objectSet
.Next();
if (delete)
{
oc.Delete(item1.untypedMember);
oc.Delete(item1.typedMember);
}
oc.Delete(item1);
if (commit)
{
oc.Commit();
}
oc.Delete(item2);
if (!commit)
{
oc.Commit();
}
}
示例13: TMembersFirst
private void TMembersFirst(IExtObjectContainer oc, string name)
{
var commit = name.IndexOf("commit") > 1;
var q = oc.Query();
q.Constrain(typeof (Item));
q.Descend("name").Constrain(name);
var objectSet = q.Execute();
var cdd = (Item) objectSet
.Next();
oc.Delete(cdd.untypedMember);
oc.Delete(cdd.typedMember);
if (commit)
{
oc.Commit();
}
oc.Delete(cdd);
if (!commit)
{
oc.Commit();
}
}
示例14: TTwoRef
private void TTwoRef(IExtObjectContainer oc, string name)
{
bool commit = name.IndexOf("commit") > 1;
bool delete = name.IndexOf("delete") > 1;
IQuery q = oc.Query();
q.Constrain(typeof(CascadeDeleteDeletedTestCase.Item));
q.Descend("name").Constrain(name);
IObjectSet objectSet = q.Execute();
CascadeDeleteDeletedTestCase.Item item1 = (CascadeDeleteDeletedTestCase.Item)objectSet
.Next();
CascadeDeleteDeletedTestCase.Item item2 = (CascadeDeleteDeletedTestCase.Item)objectSet
.Next();
if (delete)
{
oc.Delete(item1.untypedMember);
oc.Delete(item1.typedMember);
}
oc.Delete(item1);
if (commit)
{
oc.Commit();
}
oc.Delete(item2);
if (!commit)
{
oc.Commit();
}
}
示例15: TMembersFirst
private void TMembersFirst(IExtObjectContainer oc, string name)
{
bool commit = name.IndexOf("commit") > 1;
IQuery q = oc.Query();
q.Constrain(typeof(CascadeDeleteDeletedTestCase.Item));
q.Descend("name").Constrain(name);
IObjectSet objectSet = q.Execute();
CascadeDeleteDeletedTestCase.Item cdd = (CascadeDeleteDeletedTestCase.Item)objectSet
.Next();
oc.Delete(cdd.untypedMember);
oc.Delete(cdd.typedMember);
if (commit)
{
oc.Commit();
}
oc.Delete(cdd);
if (!commit)
{
oc.Commit();
}
}