本文整理汇总了C#中UnitOfWork.GetObjectCount方法的典型用法代码示例。如果您正苦于以下问题:C# UnitOfWork.GetObjectCount方法的具体用法?C# UnitOfWork.GetObjectCount怎么用?C# UnitOfWork.GetObjectCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnitOfWork
的用法示例。
在下文中一共展示了UnitOfWork.GetObjectCount方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Test_ModifyAll_Integer
public void Test_ModifyAll_Integer()
{
using (UnitOfWork uow = new UnitOfWork(DefaultDataLayer))
{
Assert.Less(uow.GetObjectCount<MySimpleObject>(MySimpleObject.Fields.IntegerProperty == 23), 1000);
uow.Update<MySimpleObject>(() => new MySimpleObject(uow) { IntegerProperty = 23 }, null);
Assert.AreEqual(1000, uow.GetObjectCount<MySimpleObject>(MySimpleObject.Fields.IntegerProperty == 23));
}
}
示例2: Test_ModifyAll_Enum
public void Test_ModifyAll_Enum()
{
using (UnitOfWork uow = new UnitOfWork(DefaultDataLayer))
{
Assert.Less(uow.GetObjectCount<MySimpleObject>(MySimpleObject.Fields.EnumProperty == new OperandValue(MyEnum.Blue)), 1000);
uow.Update<MySimpleObject>(() => new MySimpleObject(uow) { EnumProperty = MyEnum.Blue }, null);
Assert.AreEqual(1000, uow.GetObjectCount<MySimpleObject>(MySimpleObject.Fields.EnumProperty == new OperandValue(MyEnum.Blue)));
}
}
示例3: Test_ModifyNone_Integer
public void Test_ModifyNone_Integer()
{
CriteriaOperator criteria = CriteriaOperator.Parse("1=0");
using (UnitOfWork uow = new UnitOfWork(DefaultDataLayer))
{
int affectedRecords = uow.GetObjectCount<MySimpleObject>(MySimpleObject.Fields.IntegerProperty == 23);
uow.Update<MySimpleObject>(() => new MySimpleObject(uow) { IntegerProperty = 23 }, criteria);
Assert.AreEqual(affectedRecords, uow.GetObjectCount<MySimpleObject>(MySimpleObject.Fields.IntegerProperty == 23));
}
}
示例4: Test_ModifyNone_Enum
public void Test_ModifyNone_Enum()
{
CriteriaOperator criteria = CriteriaOperator.Parse("1=0");
using (UnitOfWork uow = new UnitOfWork(DefaultDataLayer))
{
int affectedRecords = uow.GetObjectCount<MySimpleObject>(MySimpleObject.Fields.EnumProperty == new OperandValue(MyEnum.Blue));
uow.Update<MySimpleObject>(() => new MySimpleObject(uow) { EnumProperty = MyEnum.Blue }, criteria);
Assert.AreEqual(affectedRecords, uow.GetObjectCount<MySimpleObject>(MySimpleObject.Fields.EnumProperty == new OperandValue(MyEnum.Blue)));
}
}
示例5: Test_ModifySome_String
public void Test_ModifySome_String()
{
CriteriaOperator criteria = MySimpleObject.Fields.EnumProperty == new OperandValue(MyEnum.Blue);
using (UnitOfWork uow = new UnitOfWork(DefaultDataLayer))
{
int affectedRecords = uow.GetObjectCount<MySimpleObject>(MySimpleObject.Fields.StringProperty == "abcdefghjiklmnopqrstuvwxyz" & !criteria)
+ uow.GetObjectCount<MySimpleObject>(criteria);
uow.Update<MySimpleObject>(() => new MySimpleObject(uow) { StringProperty = "abcdefghjiklmnopqrstuvwxyz" }, criteria);
Assert.AreEqual(affectedRecords, uow.GetObjectCount<MySimpleObject>(MySimpleObject.Fields.StringProperty == "abcdefghjiklmnopqrstuvwxyz"));
}
}
示例6: Test_ModifyNone_String
public void Test_ModifyNone_String()
{
CriteriaOperator criteria = CriteriaOperator.Parse("1=0");
using (UnitOfWork uow = new UnitOfWork(DefaultDataLayer))
{
int affectedRecords = uow.GetObjectCount<MySimpleObject>(MySimpleObject.Fields.StringProperty == "abcdefghjiklmnopqrstuvwxyz");
uow.Update<MySimpleObject>(() => new MySimpleObject(uow) { StringProperty = "abcdefghjiklmnopqrstuvwxyz" }, criteria);
Assert.AreEqual(affectedRecords, uow.GetObjectCount<MySimpleObject>(MySimpleObject.Fields.StringProperty == "abcdefghjiklmnopqrstuvwxyz"));
}
}
示例7: Test_ModifyAll_String
public void Test_ModifyAll_String()
{
using (UnitOfWork uow = new UnitOfWork(DefaultDataLayer))
{
Assert.Less(uow.GetObjectCount<MySimpleObject>(MySimpleObject.Fields.StringProperty == "abcdefghjiklmnopqrstuvwxyz"), 1000);
uow.Update<MySimpleObject>(() => new MySimpleObject(uow) { StringProperty = "abcdefghjiklmnopqrstuvwxyz" }, null);
Assert.AreEqual(1000, uow.GetObjectCount<MySimpleObject>(MySimpleObject.Fields.StringProperty == "abcdefghjiklmnopqrstuvwxyz"));
}
}
示例8: Test_ModifySome_ReferenceObject
public void Test_ModifySome_ReferenceObject()
{
CriteriaOperator criteria = CriteriaOperator.Parse("1=0");
using (UnitOfWork uow = new UnitOfWork(DefaultDataLayer))
{
var referenceObject = uow.FindObject<MyReferenceObject>(null);
Assert.AreNotEqual(Guid.Empty, referenceObject);
Guid referenceId = referenceObject.Id;
int affectedRecords = uow.GetObjectCount<MySimpleObject>(MySimpleObject.Fields.ReferenceProperty.Id == referenceId);
uow.Update<MySimpleObject>(() => new MySimpleObject(uow) { ReferenceProperty = referenceObject }, criteria);
Assert.AreEqual(affectedRecords, uow.GetObjectCount<MySimpleObject>(MySimpleObject.Fields.ReferenceProperty.Id == referenceId));
}
}
示例9: Test_ModifyAll_ReferenceObject
public void Test_ModifyAll_ReferenceObject()
{
using (UnitOfWork uow = new UnitOfWork(DefaultDataLayer))
{
var referenceObject = uow.FindObject<MyReferenceObject>(null);
Assert.AreNotEqual(Guid.Empty, referenceObject);
Guid referenceId = referenceObject.Id;
Assert.Less(uow.GetObjectCount<MySimpleObject>(MySimpleObject.Fields.ReferenceProperty.Id == referenceId), 1000);
uow.Update<MySimpleObject>(() => new MySimpleObject(uow) { ReferenceProperty = referenceObject }, null);
Assert.AreEqual(1000, uow.GetObjectCount<MySimpleObject>(MySimpleObject.Fields.ReferenceProperty.Id == referenceId));
}
}