当前位置: 首页>>代码示例>>C#>>正文


C# UnitOfWork.GetObjectCount方法代码示例

本文整理汇总了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));
     }
 }
开发者ID:ZeroSharp,项目名称:XpoBatch,代码行数:9,代码来源:Tests_Modify.cs

示例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)));
     }
 }
开发者ID:ZeroSharp,项目名称:XpoBatch,代码行数:9,代码来源:Tests_Modify.cs

示例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));
            }
        }
开发者ID:ZeroSharp,项目名称:XpoBatch,代码行数:11,代码来源:Tests_Modify.cs

示例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)));
            }
        }
开发者ID:ZeroSharp,项目名称:XpoBatch,代码行数:11,代码来源:Tests_Modify.cs

示例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"));
            }
        }
开发者ID:ZeroSharp,项目名称:XpoBatch,代码行数:12,代码来源:Tests_Modify.cs

示例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"));
            }
        }
开发者ID:ZeroSharp,项目名称:XpoBatch,代码行数:11,代码来源:Tests_Modify.cs

示例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"));
     }
 }
开发者ID:ZeroSharp,项目名称:XpoBatch,代码行数:9,代码来源:Tests_Modify.cs

示例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));
            }
        }
开发者ID:ZeroSharp,项目名称:XpoBatch,代码行数:14,代码来源:Tests_Modify.cs

示例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));
     }
 }
开发者ID:ZeroSharp,项目名称:XpoBatch,代码行数:12,代码来源:Tests_Modify.cs


注:本文中的UnitOfWork.GetObjectCount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。