本文整理汇总了C#中Table.GetNameWithSchema方法的典型用法代码示例。如果您正苦于以下问题:C# Table.GetNameWithSchema方法的具体用法?C# Table.GetNameWithSchema怎么用?C# Table.GetNameWithSchema使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Table
的用法示例。
在下文中一共展示了Table.GetNameWithSchema方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetForeignKeys
public void GetForeignKeys()
{
var table = new Table("emailAddresses", "test2", TableType.Table);
var foreignKeys = GetProvider().GetForeignKeys(table).ToList();
Assert.That(foreignKeys.Count, Is.EqualTo(1));
Assert.That(foreignKeys[0].DetailTable.ToString(), Is.EqualTo(table.GetNameWithSchema()));
Assert.That(foreignKeys[0].MasterTable.ToString(), Is.EqualTo("test2.people"));
Assert.That(foreignKeys[0].Columns[0], Is.EqualTo("id"));
Assert.That(foreignKeys[0].UniqueColumns[0], Is.EqualTo("EmailId"));
}
示例2: LoadColumn
private void LoadColumn(ColumnElement columnElement, Table table)
{
if (columnElement == null)
return;
Columns.Add(new Tuple<string, string, DbType, int>(table.GetNameWithSchema(), columnElement.Name,DbTypeConverter.FromDataType(columnElement.DataType), columnElement.Length));
if(columnElement.IsPrimaryKey)
{
PrimaryKeys.Add(new Tuple<string, string>(table.GetNameWithSchema(), columnElement.Name));
}
if(!string.IsNullOrWhiteSpace(columnElement.ForeignKey))
{
var parts = columnElement.ForeignKey.Split('.');
var schemaName = parts.Length > 2 ? parts[0] : null;
var objectName = parts.Length > 2 ? parts[1] : parts[0];
var columnName = parts.Length > 2 ? parts[2] : parts[1];
ForeignKeys.Add(new ForeignKey(new ObjectName(table.Schema, table.ActualName), new[] { columnElement.Name }, new ObjectName(schemaName, objectName), new[] { columnName }));
}
}
示例3: GetPrimaryKey
public override Key GetPrimaryKey(Table table)
{
return new Key(Reflector.PrimaryKeys.Where(t => t.Item1.InvariantEquals(table.GetNameWithSchema())).Select(t => t.Item2));
}
示例4: GetForeignKeys
public override IEnumerable<ForeignKey> GetForeignKeys(Table table)
{
return Reflector.ForeignKeys.Where(fk => fk.DetailTable.ToString().InvariantEquals(table.GetNameWithSchema()));
}
示例5: GetColumns
public override IEnumerable<Column> GetColumns(Table table)
{
return Reflector.Columns
.Where(c => table.GetNameWithSchema().InvariantEquals(c.Item1))
.Select(c => new Column(c.Item2, table, false, c.Item3, c.Item4));
}