本文整理汇总了C#中Table.GetSql方法的典型用法代码示例。如果您正苦于以下问题:C# Table.GetSql方法的具体用法?C# Table.GetSql怎么用?C# Table.GetSql使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Table
的用法示例。
在下文中一共展示了Table.GetSql方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SqlServerMap_ShouldGenerate_ValidSql_User2
public void SqlServerMap_ShouldGenerate_ValidSql_User2()
{
Table<User2> t = new Table<User2>(SqlServerDataTypesMap.Instance);
t.GetSql().Should().Be("CREATE TABLE Users (FirstName VARCHAR(20), LastName VARCHAR(30), Gender INT NOT NULL, Income FLOAT NULL, CONSTRAINT pk_Users PRIMARY KEY (FirstName, LastName))");
}
示例2: SqlServerMap_ShouldGenerate_ValidTimespan
public void SqlServerMap_ShouldGenerate_ValidTimespan()
{
Table<CWithTimeSpan> t = new Table<CWithTimeSpan>(SqlServerDataTypesMap.Instance);
t.GetSql().Should().Be("CREATE TABLE CWithTimeSpan (Span BIGINT NULL)");
}
示例3: SqliteMap_ShouldGenerate_ValidSql_User2
public void SqliteMap_ShouldGenerate_ValidSql_User2()
{
Table<User2> t = new Table<User2>(SqliteDataTypesMap.Instance);
t.GetSql().Should().Be("CREATE TABLE Users (FirstName TEXT, LastName TEXT, Gender INTEGER NOT NULL, Income REAL NULL, PRIMARY KEY (FirstName, LastName))");
}
示例4: SqlServerMap_ShouldGenerate_ValidSql_PK
public void SqlServerMap_ShouldGenerate_ValidSql_PK()
{
Table<PK> t = new Table<PK>(SqlServerDataTypesMap.Instance);
t.GetSql().Should().Be("CREATE TABLE PK (ID INT PRIMARY KEY IDENTITY)");
}
示例5: Sql_ShouldNotContain_IgnoredProperty
public void Sql_ShouldNotContain_IgnoredProperty()
{
Table<User2> t = new Table<User2>(MySqlDataTypesMap.Instance);
t.GetSql().Should().NotContain("IsEmployed");
}
示例6: SqliteMap_ShouldGenerate_ValidSql_PK
public void SqliteMap_ShouldGenerate_ValidSql_PK()
{
Table<PK> t = new Table<PK>(SqliteDataTypesMap.Instance);
t.GetSql().Should().Be("CREATE TABLE PK (ID INTEGER PRIMARY KEY AUTOINCREMENT)");
}
示例7: Sql_ShouldContain_TableName_SpecifiedByAttribute
public void Sql_ShouldContain_TableName_SpecifiedByAttribute()
{
Table<User2> t = new Table<User2>(MySqlDataTypesMap.Instance);
t.GetSql().Should().Contain("TABLE Users");
}
示例8: Sql_ShouldContain_CompositePrimaryKey
public void Sql_ShouldContain_CompositePrimaryKey()
{
Table<User2> t = new Table<User2>(MySqlDataTypesMap.Instance);
t.GetSql().Should().Contain(MySqlDataTypesMap.Instance.Expressions[SqlExpressions.PrimaryKeyDeclaredOnTable].Replace(DbDataTypesMapBase.ReplacementStrings.TableName, t.TableName));
}
示例9: Sql_ShouldContain_StringWithLength_SpecifiedByAttribute
public void Sql_ShouldContain_StringWithLength_SpecifiedByAttribute()
{
Table<User2> t = new Table<User2>(MySqlDataTypesMap.Instance);
t.GetSql().Should().Contain("VARCHAR(30)");
}
示例10: Sql_ShouldContain_TableName
public void Sql_ShouldContain_TableName()
{
Table<PK> t = new Table<PK>(MySqlDataTypesMap.Instance);
t.GetSql().Should().Contain("PK");
}
示例11: Sql_ShouldContain_PrimaryKey
public void Sql_ShouldContain_PrimaryKey()
{
Table<PK> t = new Table<PK>(MySqlDataTypesMap.Instance);
t.GetSql().Should().Contain(MySqlDataTypesMap.Instance.Expressions[SqlExpressions.PrimaryKeyDeclaredOnColumn]);
}
示例12: Sql_ShouldContain_Null
public void Sql_ShouldContain_Null()
{
Table<User> t = new Table<User>(MySqlDataTypesMap.Instance);
t.GetSql().Should().Contain(MySqlDataTypesMap.SqlStrings.Null);
}
示例13: Sql_ShouldContain_DoubleWithLength_SpecifiedByAttribute
public void Sql_ShouldContain_DoubleWithLength_SpecifiedByAttribute()
{
Table<User2> t = new Table<User2>(MySqlDataTypesMap.Instance);
t.GetSql().Should().Contain("(10,2)");
}
示例14: Sql_ShouldContain_AutoincrementParameter
public void Sql_ShouldContain_AutoincrementParameter()
{
Table<PK> t = new Table<PK>(MySqlDataTypesMap.Instance);
t.GetSql().Should().Contain(MySqlDataTypesMap.Instance.Expressions[SqlExpressions.AutoIncrement]);
}
示例15: Sql_ShouldContain_Varchar
public void Sql_ShouldContain_Varchar()
{
Table<User> t = new Table<User>(MySqlDataTypesMap.Instance);
t.GetSql().Should().Contain(MySqlDataTypesMap.Instance[typeof(string)]);
}