本文整理汇总了C#中InMemoryAdapter.SetAutoIncrementColumn方法的典型用法代码示例。如果您正苦于以下问题:C# InMemoryAdapter.SetAutoIncrementColumn方法的具体用法?C# InMemoryAdapter.SetAutoIncrementColumn怎么用?C# InMemoryAdapter.SetAutoIncrementColumn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InMemoryAdapter
的用法示例。
在下文中一共展示了InMemoryAdapter.SetAutoIncrementColumn方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AutoIncrementShouldReturnNextIdInSequenceWhenOneRowExsists
public void AutoIncrementShouldReturnNextIdInSequenceWhenOneRowExsists()
{
// Arrange
var adapter = new InMemoryAdapter();
adapter.SetAutoIncrementColumn("Users", "Id");
Database.UseMockAdapter(adapter);
var db = Database.Open();
db.Users.Insert(Name: "Marcus");
// Act
var newId = db.Users.Insert(Name: "Per").Id;
// Assert
Assert.AreEqual(2, newId);
}
示例2: LeftJoinTest
public void LeftJoinTest()
{
var adapter = new InMemoryAdapter();
adapter.SetKeyColumn("Events", "Id");
adapter.SetAutoIncrementColumn("Events", "Id");
adapter.SetKeyColumn("Doors", "Id");
adapter.SetAutoIncrementColumn("Doors", "Id");
adapter.Join.Master("Events", "Id").Detail("Doors", "EventId");
Database.UseMockAdapter(adapter);
var db = Database.Open();
db.Events.Insert(Id: 1, Code: "CodeMash2013", Name: "CodeMash 2013");
db.Events.Insert(Id: 2, Code: "SomewhereElse", Name: "Some Other Conf");
db.Doors.Insert(Id: 1, Code: "F7E08AC9-5E75-417D-A7AA-60E88B5B99AD", EventID: 1);
db.Doors.Insert(Id: 2, Code: "0631C802-2748-4C63-A6D9-CE8C803002EB", EventID: 1);
db.Doors.Insert(Id: 3, Code: "281ED88F-677D-49B9-84FA-4FAE022BBC73", EventID: 1);
db.Doors.Insert(Id: 4, Code: "9DF7E964-1ECE-42E3-8211-1F2BF7054A0D", EventID: 2);
db.Doors.Insert(Id: 5, Code: "9418123D-312A-4E8C-8807-59F0A63F43B9", EventID: 2);
List<dynamic> actual = db.Doors.FindAll(db.Doors.Events.Code == "CodeMash2013")
.Select(db.Doors.Id, db.Events.Name)
.ToList();
Assert.AreEqual(3, actual.Count);
}
示例3: AutoIncrementShouldSet1ForAutoIncrementedColumnsWhenNoRowsInTable
public void AutoIncrementShouldSet1ForAutoIncrementedColumnsWhenNoRowsInTable()
{
// Arrange
var adapter = new InMemoryAdapter();
adapter.SetAutoIncrementColumn("Users", "Id");
Database.UseMockAdapter(adapter);
var db = Database.Open();
// Act
var newId = db.Users.Insert(Name: "Marcus").Id;
// Assert
Assert.AreEqual(1, newId);
}