本文整理汇总了C#中Table.GetUpScript方法的典型用法代码示例。如果您正苦于以下问题:C# Table.GetUpScript方法的具体用法?C# Table.GetUpScript怎么用?C# Table.GetUpScript使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Table
的用法示例。
在下文中一共展示了Table.GetUpScript方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WhenColumnWithNotNull_GetCorrespondingTableScript
public void WhenColumnWithNotNull_GetCorrespondingTableScript()
{
var table = new Table("TestTables");
table.AddColumn("MyColumn", new Int()).NotNull();
var createScript = table.GetUpScript().Single();
Assert.Equal("CREATE TABLE TestTables\r\n(\r\nMyColumn int NOT NULL\r\n)", createScript);
}
示例2: WhenCreateTableWithNotNullAndPrimaryKey_GetCorrespondingTableScript
public void WhenCreateTableWithNotNullAndPrimaryKey_GetCorrespondingTableScript()
{
var table = new Table("TestTables");
table.AddColumn("MyIdColumn", new Int()).PrimaryKey();
table.AddColumn("MyValue", new NVarChar(100));
var createScript = table.GetUpScript().Single();
Assert.Equal("CREATE TABLE TestTables\r\n(\r\nMyIdColumn int NOT NULL PRIMARY KEY,\r\nMyValue nvarchar(100)\r\n)", createScript);
}
示例3: WhenCreateTableWithNamedPrimaryKey_GetCorrespondingTableScript
public void WhenCreateTableWithNamedPrimaryKey_GetCorrespondingTableScript()
{
var table = new Table("TestTables");
table.AddColumn("Key1", new Int()).PrimaryKey("PrimaryKeyForTestTables");
table.AddColumn("Key2", new Int()).PrimaryKey("PrimaryKeyForTestTables");
var createScript = table.GetUpScript().Single();
Assert.Equal("CREATE TABLE TestTables\r\n(\r\nKey1 int NOT NULL,\r\nKey2 int NOT NULL,\r\nCONSTRAINT PrimaryKeyForTestTables PRIMARY KEY (Key1,Key2)\r\n)", createScript);
}
示例4: WhenCreateTableWithAutoIncrementAsNoPrimaryKey_GetCorrespondingTableScript
public void WhenCreateTableWithAutoIncrementAsNoPrimaryKey_GetCorrespondingTableScript()
{
var table = new Table("TestTables");
table.AddColumn("MyIdColumn", new Int()).AutoIncrement(primaryKey: false);
table.AddColumn("MyValue", new NVarChar(100));
var createScript = table.GetUpScript().Single();
Assert.Equal("CREATE TABLE TestTables\r\n(\r\nMyIdColumn int IDENTITY(1,1),\r\nMyValue nvarchar(100)\r\n)", createScript);
}
示例5: WhenCreateTableWithNamedUniquesAndOneUniqueColumn_GetCorrespondingTableScript
public void WhenCreateTableWithNamedUniquesAndOneUniqueColumn_GetCorrespondingTableScript()
{
var table = new Table("TestTables");
table.AddColumn("Col1", new Int()).Unique("PrimaryKeyForTestTables");
table.AddColumn("Col2", new Int()).Unique("PrimaryKeyForTestTables");
table.AddColumn("Col3", new Int()).Unique();
var createScript = table.GetUpScript().Single();
Assert.Equal("CREATE TABLE TestTables\r\n(\r\nCol1 int,\r\nCol2 int,\r\nCol3 int UNIQUE,\r\nCONSTRAINT PrimaryKeyForTestTables UNIQUE (Col1,Col2)\r\n)", createScript);
}
示例6: WhenGuidColumn_GetCorrespondingTableScript
public void WhenGuidColumn_GetCorrespondingTableScript()
{
var table = new Table("TestTables");
table.AddColumn("MyColumn", new Guid()).NotNull();
var createScript = table.GetUpScript().Single();
Assert.Equal("CREATE TABLE TestTables\r\n(\r\nMyColumn uniqueidentifier NOT NULL\r\n)", createScript);
}