本文整理汇总了C#中IStructureSchema.GetIndexesTableName方法的典型用法代码示例。如果您正苦于以下问题:C# IStructureSchema.GetIndexesTableName方法的具体用法?C# IStructureSchema.GetIndexesTableName怎么用?C# IStructureSchema.GetIndexesTableName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IStructureSchema
的用法示例。
在下文中一共展示了IStructureSchema.GetIndexesTableName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenerateSql
public string GenerateSql(IStructureSchema structureSchema)
{
var columnDefinitions = structureSchema.IndexAccessors
.Select(GenerateColumnDefinition);
var columnsString = string.Join(",", columnDefinitions);
var sql = structureSchema.IdAccessor.IdType == IdTypes.Guid
? _sqlStrings.GetSql("CreateIndexesGuid")
: _sqlStrings.GetSql("CreateIndexesIdentity");
return sql.Inject(
structureSchema.GetStructureTableName(),
structureSchema.GetIndexesTableName(),
columnsString);
}
示例2: Upsert
public void Upsert(IStructureSchema structureSchema)
{
var structuresTableName = structureSchema.GetStructureTableName();
var indexesTableName = structureSchema.GetIndexesTableName();
var uniquesTableName = structureSchema.GetUniquesTableName();
var structuresTableExists = _dbClient.TableExists(structuresTableName);
var indexesTableExists = _dbClient.TableExists(indexesTableName);
var uniquesTableExists = _dbClient.TableExists(uniquesTableName);
if (structuresTableExists && indexesTableExists && uniquesTableExists)
{
_indexesDbSchemaSynchronizer.Synchronize(structureSchema);
_uniquesDbSchemaSynchronizer.Synchronize(structureSchema);
return;
}
var structuresSql = structuresTableExists ? "" : _structuresDbSchemaBuilder.GenerateSql(structureSchema);
var indexesSql = indexesTableExists ? "" : _indexesDbSchemaBuilder.GenerateSql(structureSchema);
var uniquesSql = uniquesTableExists ? "" : _uniquesDbSchemaBuilder.GenerateSql(structureSchema);
using (var cmd = _dbClient.CreateCommand(CommandType.Text, null,
new QueryParameter("entityHash", structureSchema.Hash),
new QueryParameter("entityName", structureSchema.Name)))
{
if (!structuresTableExists)
{
cmd.CommandText = structuresSql;
cmd.ExecuteNonQuery();
}
if (!indexesTableExists)
{
cmd.CommandText = indexesSql;
cmd.ExecuteNonQuery();
}
else
_indexesDbSchemaSynchronizer.Synchronize(structureSchema);
if (!uniquesTableExists)
{
cmd.CommandText = uniquesSql;
cmd.ExecuteNonQuery();
}
else
_uniquesDbSchemaSynchronizer.Synchronize(structureSchema);
}
}
示例3: DropStructureSet
public void DropStructureSet(IStructureSchema structureSchema)
{
lock (_upsertedSchemas)
{
_upsertedSchemas.Remove(structureSchema.Name);
var sql = _sqlStrings.GetSql("DropStructureTables").Inject(
structureSchema.GetIndexesTableName(),
structureSchema.GetStructureTableName());
using (var client = new SqlDbClient(_connectionInfo, false))
{
client.ExecuteNonQuery(CommandType.Text, sql, new QueryParameter("entityHash", structureSchema.Hash));
}
}
}
示例4: Synchronize
public void Synchronize(IStructureSchema structureSchema)
{
var tableName = structureSchema.GetIndexesTableName();
var schemaChanges = GetSchemaChanges(structureSchema);
if (schemaChanges.Count() < 1)
return;
var columnsToDrop = schemaChanges
.Where(sc => sc.Change == SchemaChanges.IsObsoleteColumn)
.ToList();
DropColumns(tableName, columnsToDrop);
var columnsToAdd = schemaChanges
.Where(sc => sc.Change == SchemaChanges.IsMissingColumn)
.ToList();
AddColumns(tableName, columnsToAdd);
}
示例5: IndexStorageSchema
internal IndexStorageSchema(IStructureSchema structureSchema)
: base(structureSchema, structureSchema.GetIndexesTableName())
{
}
示例6: GetIndexesColumns
private IList<SqlDbColumn> GetIndexesColumns(IStructureSchema structureSchema)
{
var dbColumns = _dbClient.GetColumns(structureSchema.GetIndexesTableName(), IndexStorageSchema.Fields.StructureId.Name);
return dbColumns ?? new List<SqlDbColumn>();
}