本文整理汇总了C#中IExtObjectContainer.Query方法的典型用法代码示例。如果您正苦于以下问题:C# IExtObjectContainer.Query方法的具体用法?C# IExtObjectContainer.Query怎么用?C# IExtObjectContainer.Query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IExtObjectContainer
的用法示例。
在下文中一共展示了IExtObjectContainer.Query方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Conc
public virtual void Conc(IExtObjectContainer oc)
{
IQuery q = oc.Query();
q.Constrain(typeof(Db4objects.Db4o.Tests.Common.Concurrency.QueryForUnknownFieldTestCase
));
q.Descend("_name").Constrain("name");
Assert.AreEqual(1, q.Execute().Count);
q = oc.Query();
q.Constrain(typeof(Db4objects.Db4o.Tests.Common.Concurrency.QueryForUnknownFieldTestCase
));
q.Descend("name").Constrain("name");
Assert.AreEqual(0, q.Execute().Count);
}
示例2: Conc
public virtual void Conc(IExtObjectContainer oc)
{
var q = oc.Query();
q.Constrain(typeof (QueryForUnknownFieldTestCase
));
q.Descend("_name").Constrain("name");
Assert.AreEqual(1, q.Execute().Count);
q = oc.Query();
q.Constrain(typeof (QueryForUnknownFieldTestCase
));
q.Descend("name").Constrain("name");
Assert.AreEqual(0, q.Execute().Count);
}
示例3: AssertDateTimeQuery
private void AssertDateTimeQuery(IExtObjectContainer objectContainer, DateTime value)
{
IQuery query = objectContainer.Query();
query.Constrain(typeof (Item));
query.Descend("_dateTime").Constrain(value);
Assert.AreEqual(1, query.Execute().Count);
}
示例4: Conc
public virtual void Conc(IExtObjectContainer oc)
{
int[] expect = new int[] { 3, 4, 5 };
IQuery q = oc.Query();
q.Constrain(typeof(Db4objects.Db4o.Tests.Common.Concurrency.GreaterOrEqualTestCase
));
q.Descend("val").Constrain(3).Greater().Equal();
IObjectSet res = q.Execute();
while (res.HasNext())
{
Db4objects.Db4o.Tests.Common.Concurrency.GreaterOrEqualTestCase r = (Db4objects.Db4o.Tests.Common.Concurrency.GreaterOrEqualTestCase
)res.Next();
for (int i = 0; i < expect.Length; i++)
{
if (expect[i] == r.val)
{
expect[i] = 0;
}
}
}
for (int i = 0; i < expect.Length; i++)
{
Assert.AreEqual(0, expect[i]);
}
}
示例5: ConcReadDifferentObject
/// <exception cref="System.Exception"></exception>
public virtual void ConcReadDifferentObject(IExtObjectContainer oc, int seq)
{
SimpleObject expected = new SimpleObject(testString + seq, seq);
IObjectSet result = oc.Query(new ReadObjectNQTestCase.MyPredicate(expected));
Assert.AreEqual(1, result.Count);
Assert.AreEqual(expected, result.Next());
}
示例6: 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));
}
示例7: 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);
}
}
示例8: QueryContains
private IObjectSet QueryContains(IExtObjectContainer oc, string str)
{
var q = oc.Query();
q.Constrain(typeof (ParameterizedEvaluationTestCase));
q.Constrain(new MyEvaluation(str));
return q.Execute();
}
示例9: Conc1
/// <exception cref="System.Exception"></exception>
public virtual void Conc1(IExtObjectContainer oc)
{
IObjectSet os = oc.Query(typeof(DualDeleteTestCase.Item));
Thread.Sleep(500);
DeleteObjectSet(oc, os);
oc.Rollback();
}
示例10: Conc
public virtual void Conc(IExtObjectContainer oc)
{
int[] expect = {3, 4, 5};
var q = oc.Query();
q.Constrain(typeof (GreaterOrEqualTestCase
));
q.Descend("val").Constrain(3).Greater().Equal();
var res = q.Execute();
while (res.HasNext())
{
var r = (GreaterOrEqualTestCase
) res.Next();
for (var i = 0; i < expect.Length; i++)
{
if (expect[i] == r.val)
{
expect[i] = 0;
}
}
}
for (var i = 0; i < expect.Length; i++)
{
Assert.AreEqual(0, expect[i]);
}
}
示例11: ConcQueryCaseInsenstive
public virtual void ConcQueryCaseInsenstive(IExtObjectContainer oc)
{
var q = oc.Query();
q.Constrain(typeof (CaseInsensitiveTestCase
));
q.Constrain(new CaseInsensitiveEvaluation("helloworld"));
Assert.AreEqual(1, q.Execute().Count);
}
示例12: ConcQueryCaseInsenstive
public virtual void ConcQueryCaseInsenstive(IExtObjectContainer oc)
{
IQuery q = oc.Query();
q.Constrain(typeof(Db4objects.Db4o.Tests.Common.Concurrency.CaseInsensitiveTestCase
));
q.Constrain(new CaseInsensitiveTestCase.CaseInsensitiveEvaluation("helloworld"));
Assert.AreEqual(1, q.Execute().Count);
}
示例13: Check2
public virtual void Check2(IExtObjectContainer oc)
{
IQuery q = oc.Query();
q.Constrain(typeof(MultiLevelIndexTestCase));
q.Descend("_child").Descend("_i").Constrain(-200).Smaller();
IObjectSet objectSet = q.Execute();
Assert.AreEqual(ThreadCount(), objectSet.Count);
}
示例14: ConcReadSameObject
/// <exception cref="System.Exception"></exception>
public virtual void ConcReadSameObject(IExtObjectContainer oc)
{
int mid = ThreadCount() / 2;
SimpleObject expected = new SimpleObject(testString + mid, mid);
IObjectSet result = oc.Query(new ReadObjectNQTestCase.MyPredicate(expected));
Assert.AreEqual(1, result.Count);
Assert.AreEqual(expected, result.Next());
}
示例15: QuerySpecificObjects
private static IObjectSet QuerySpecificObjects(IExtObjectContainer objectContainer)
{
var query = objectContainer.Query();
query.Constrain(typeof (Item));
query.Descend("value").Constrain(42);
return query.Execute();
}