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


C# SQLHelper.Paged方法代码示例

本文整理汇总了C#中Utilities.SQL.SQLHelper.Paged方法的典型用法代码示例。如果您正苦于以下问题:C# SQLHelper.Paged方法的具体用法?C# SQLHelper.Paged怎么用?C# SQLHelper.Paged使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Utilities.SQL.SQLHelper的用法示例。


在下文中一共展示了SQLHelper.Paged方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Paged

 public void Paged()
 {
     using (Utilities.SQL.SQLHelper Helper2 = new Utilities.SQL.SQLHelper("", "Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false", CommandType.Text))
     {
         Mapping<ObjectClass1> TestObject = Utilities.SQL.SQLHelper.Map<ObjectClass1>("TestTable", "ID_");
         TestObject.Map(x => x.ID, "ID_")
             .Map(x => x.StringValue, "StringValue_")
             .Map(x => x.FloatValue, "FloatValue_")
             .Map(x => x.BoolValue, "BoolValue_")
             .Map(x => x.LongValue, "LongValue_")
             .Map(x => x.StringMaxValue, "StringMaxValue_");
         List<ObjectClass1> Objects2 = new List<ObjectClass1>();
         Utilities.Random.Random Rand = new Utilities.Random.Random();
         for (int x = 0; x < 115; ++x)
         {
             ObjectClass1 TempObject = new ObjectClass1();
             TempObject.StringValue = Rand.Next<string>(new RegexStringGenerator(10));
             TempObject.BoolValue = Rand.Next<bool>();
             TempObject.FloatValue = (float)Rand.NextDouble();
             TempObject.LongValue = Rand.Next(0, 100);
             TempObject.StringMaxValue = Rand.Next<string>(new RegexStringGenerator(6000));
             Objects2.Add(TempObject);
         }
         Helper2.Save<ObjectClass1, int>(Objects2);
         IEnumerable<ObjectClass1> Objects = Helper2.Paged<ObjectClass1>();
         Assert.Equal(25, Objects.Count());
         Objects = Helper2.Paged<ObjectClass1>(CurrentPage: 1);
         Assert.Equal(25, Objects.Count());
         Objects = Helper2.Paged<ObjectClass1>(CurrentPage: 2);
         Assert.Equal(25, Objects.Count());
         Objects = Helper2.Paged<ObjectClass1>(CurrentPage: 3);
         Assert.Equal(25, Objects.Count());
         Objects = Helper2.Paged<ObjectClass1>(CurrentPage: 4);
         Assert.Equal(15, Objects.Count());
         Assert.Equal(5, Helper2.PageCount<ObjectClass1>());
     }
 }
开发者ID:AngelMarquez,项目名称:Craig-s-Utility-Library,代码行数:37,代码来源:Mapping.cs

示例2: Paged

 public void Paged()
 {
     Utilities.SQL.SQLHelper.Database("Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false");
     Utilities.SQL.SQLHelper.Map<ObjectClass1>("TestTable", "ID_")
             .Map(x => x.ID, "ID_")
             .Map(x => x.StringValue, "StringValue_")
             .Map(x => x.FloatValue, "FloatValue_")
             .Map(x => x.BoolValue, "BoolValue_")
             .Map(x => x.LongValue, "LongValue_");
     ObjectClass1 TempObject = null;
     Utilities.Random.Random Rand = new Utilities.Random.Random();
     using (Utilities.SQL.SQLHelper ORM = new Utilities.SQL.SQLHelper())
     {
         for (int x = 0; x < 115; ++x)
         {
             TempObject = new ObjectClass1();
             TempObject.StringValue = Rand.Next<string>(new RegexStringGenerator(10));
             TempObject.BoolValue = Rand.Next<bool>();
             TempObject.FloatValue = (float)Rand.NextDouble();
             TempObject.LongValue = Rand.Next();
             ORM.Save<ObjectClass1, int>(TempObject);
         }
         TempObject = null;
         IEnumerable<ObjectClass1> Objects = ORM.Paged<ObjectClass1>();
         Assert.Equal(25, Objects.Count());
         Objects = ORM.Paged<ObjectClass1>(CurrentPage: 1);
         Assert.Equal(25, Objects.Count());
         Objects = ORM.Paged<ObjectClass1>(CurrentPage: 2);
         Assert.Equal(25, Objects.Count());
         Objects = ORM.Paged<ObjectClass1>(CurrentPage: 3);
         Assert.Equal(25, Objects.Count());
         Objects = ORM.Paged<ObjectClass1>(CurrentPage: 4);
         Assert.Equal(15, Objects.Count());
         Assert.Equal(5, ORM.PageCount<ObjectClass1>());
     }
 }
开发者ID:AngelMarquez,项目名称:Craig-s-Utility-Library,代码行数:36,代码来源:MicroORM.cs


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