本文整理汇总了C#中IDatabase.AddTable方法的典型用法代码示例。如果您正苦于以下问题:C# IDatabase.AddTable方法的具体用法?C# IDatabase.AddTable怎么用?C# IDatabase.AddTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDatabase
的用法示例。
在下文中一共展示了IDatabase.AddTable方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AfterglowRuntime
public AfterglowRuntime(IDatabase database, ILogger logger, ILoader loader)
{
this._database = database;
this._logger = logger;
this.Loader = loader;
Settings = new Settings(database.AddTable("Settings"), logger, this);
}
示例2: CreateTable
private static ITable CreateTable(IDatabase db, string tableName)
{
var table = new Table(tableName);
table.AddColumn(new Column("Column1"));
table.AddColumn(new Column("Column2"));
table.AddColumn(new Column("Column3"));
var primaryKey = new Key("PrimaryKey", DatabaseKeyType.Primary);
table.AddKey(primaryKey);
var foreignKey = new Key("ForeignKey", DatabaseKeyType.Foreign);
table.AddKey(foreignKey);
primaryKey.AddColumn("Column1");
foreignKey.AddColumn("Column1");
db.AddTable(table);
return table;
}
示例3: CreateMappingFor
private Mapping CreateMappingFor(Entity entity, @class hEntity, IDatabase database, string defaultSchema)
{
if (hEntity.table == null)
return null;
Mapping mapping = new MappingImpl();
string schema = string.IsNullOrEmpty(hEntity.schema) ? defaultSchema : hEntity.schema;
var table = database.GetTable(hEntity.table.UnBackTick(), schema.UnBackTick());
if (table == null)
{
// create the table
table = entityProcessor.CreateTable(entity);
database.AddTable(table);
}
mapping.FromTable = table;
mapping.ToEntity = entity;
return mapping;
}
示例4: SetupDatabase
private static void SetupDatabase(IDatabase db, int numTables, int numColumns)
{
for (int i = 0; i < numTables; i++)
db.AddTable(new Table("Table" + i, ""));
for (int i = 0; i < db.Tables.Count; i++)
{
ITable table = db.Tables[i];
for (int j = 0; j < numColumns; j++ )
table.AddColumn(new Column("Column" + j));
}
}
示例5: Setup
public void Setup()
{
db = TestDatabaseLoader.TestDatabase();
var t2 = new Table("Table2");
db.AddTable(t2);
t2.AddColumn(new Column("Column1") { InPrimaryKey = true, Datatype = "int", OrdinalPosition = 0, Size = 4 });
t2.AddColumn(new Column("Column2") { Datatype = "nvarchar", OrdinalPosition = 1, Size = 100 });
t2.AddColumn(new Column("Column3") { Datatype = "datetime", OrdinalPosition = 2, Size = 8 });
t2.AddIndex(new Index("PK_Table2") { IsUnique = true, Datatype = DatabaseIndexType.PrimaryKey }).AddColumn("Column1");
t2.AddKey(new Key("PK_Table2") { Keytype = DatabaseKeyType.Primary }).AddColumn("Column1").AddColumn("Column2");
t2.CreateRelationshipTo(db.Tables[0]);
}