本文整理汇总了C#中IStructureSchema.GetUniquesTableName方法的典型用法代码示例。如果您正苦于以下问题:C# IStructureSchema.GetUniquesTableName方法的具体用法?C# IStructureSchema.GetUniquesTableName怎么用?C# IStructureSchema.GetUniquesTableName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IStructureSchema
的用法示例。
在下文中一共展示了IStructureSchema.GetUniquesTableName方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DeleteRecordsMatchingKeyNames
private void DeleteRecordsMatchingKeyNames(IStructureSchema structureSchema, IEnumerable<string> names)
{
var inString = string.Join(",", names.Select(n => "'" + n + "'"));
var sql = _sqlStrings.GetSql("UniquesSchemaSynchronizer_DeleteRecordsMatchingKeyNames")
.Inject(structureSchema.GetUniquesTableName(), UniqueStorageSchema.Fields.Name.Name, inString);
_dbClient.ExecuteNonQuery(CommandType.Text, sql);
}
示例2: DeleteRecordsMatchingKeyNames
private void DeleteRecordsMatchingKeyNames(IStructureSchema structureSchema, IEnumerable<string> names, IDbClient dbClient)
{
var inString = string.Join(",", names.Select(n => "'" + n + "'"));
var sql = _sqlStatements.GetSql("UniquesSchemaSynchronizer_DeleteRecordsMatchingKeyNames")
.Inject(structureSchema.GetUniquesTableName(), UniqueStorageSchema.Fields.UqMemberPath.Name, inString);
dbClient.ExecuteNonQuery(sql);
}
示例3: GenerateSql
public string GenerateSql(IStructureSchema structureSchema)
{
var sql = structureSchema.IdAccessor.IdType == IdTypes.Guid
? _sqlStrings.GetSql("CreateUniquesGuid")
: _sqlStrings.GetSql("CreateUniquesIdentity");
return sql.Inject(
structureSchema.GetStructureTableName(),
structureSchema.GetUniquesTableName());
}
示例4: GetExistingDbKeyNames
private IEnumerable<string> GetExistingDbKeyNames(IStructureSchema structureSchema, IDbClient dbClient)
{
var dbColumns = new List<string>();
dbClient.Read(
_sqlStatements.GetSql("UniquesSchemaSynchronizer_GetKeyNames").Inject(
UniqueStorageSchema.Fields.UqMemberPath.Name,
structureSchema.GetUniquesTableName()),
dr => dbColumns.Add(dr.GetString(0)));
return dbColumns;
}
示例5: GetKeyNames
private IEnumerable<string> GetKeyNames(IStructureSchema structureSchema)
{
var dbColumns = new List<string>();
_dbClient.ExecuteSingleResultReader(CommandType.Text,
_sqlStrings.GetSql("UniquesSchemaSynchronizer_GetKeyNames")
.Inject(
UniqueStorageSchema.Fields.Name.Name, structureSchema.GetUniquesTableName()),
dr => dbColumns.Add(dr.GetString(0)));
return dbColumns;
}
示例6: 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);
}
}
示例7: GenerateSql
public string GenerateSql(IStructureSchema structureSchema)
{
var uniquesTableName = structureSchema.GetUniquesTableName();
var structureTableName = structureSchema.GetStructureTableName();
if (structureSchema.IdAccessor.IdType == StructureIdTypes.String)
return _sqlStatements.GetSql("CreateUniquesString").Inject(uniquesTableName, structureTableName);
if (structureSchema.IdAccessor.IdType == StructureIdTypes.Guid)
return _sqlStatements.GetSql("CreateUniquesGuid").Inject(uniquesTableName, structureTableName);
if (structureSchema.IdAccessor.IdType.IsIdentity())
return _sqlStatements.GetSql("CreateUniquesIdentity").Inject(uniquesTableName, structureTableName);
throw new SisoDbException(ExceptionMessages.SqlDbUniquesSchemaBuilder_GenerateSql.Inject(structureSchema.IdAccessor.IdType));
}
示例8: Drop
public override void Drop(IStructureSchema structureSchema)
{
Ensure.That(structureSchema, "structureSchema").IsNotNull();
var indexesTableNames = structureSchema.GetIndexesTableNames();
var sql = SqlStatements.GetSql("DropStructureTables").Inject(
indexesTableNames.IntegersTableName,
indexesTableNames.FractalsTableName,
indexesTableNames.BooleansTableName,
indexesTableNames.DatesTableName,
indexesTableNames.GuidsTableName,
indexesTableNames.StringsTableName,
indexesTableNames.TextsTableName,
structureSchema.GetUniquesTableName(),
structureSchema.GetStructureTableName());
using (var cmd = CreateCommand(sql, new DacParameter("entityName", structureSchema.Name)))
{
cmd.ExecuteNonQuery();
}
}
示例9: Drop
public override void Drop(IStructureSchema structureSchema)
{
Ensure.That(structureSchema, "structureSchema").IsNotNull();
var modelInfo = GetModelTablesInfo(structureSchema);
var sqlDropTableFormat = SqlStatements.GetSql("DropTable");
using (var cmd = CreateCommand(string.Empty, new DacParameter(DbSchemas.Parameters.EntityNameParamPrefix, structureSchema.Name)))
{
DropIndexesTables(cmd, modelInfo.Statuses.IndexesTableStatuses, modelInfo.Names.IndexesTableNames);
if (modelInfo.Statuses.UniquesTableExists)
{
cmd.CommandText = sqlDropTableFormat.Inject(structureSchema.GetUniquesTableName());
cmd.ExecuteNonQuery();
}
if (modelInfo.Statuses.StructureTableExists)
{
cmd.CommandText = sqlDropTableFormat.Inject(structureSchema.GetStructureTableName());
cmd.ExecuteNonQuery();
}
cmd.CommandText = SqlStatements.GetSql("DeleteStructureFromSisoDbIdentitiesTable");
cmd.ExecuteNonQuery();
}
}
示例10: BulkInsertUniques
protected virtual void BulkInsertUniques(IStructureSchema structureSchema, IStructureIndex[] uniques)
{
if (!uniques.Any())
return;
var uniquesStorageSchema = new UniqueStorageSchema(structureSchema, structureSchema.GetUniquesTableName());
using (var uniquesReader = new UniquesReader(uniquesStorageSchema, uniques))
{
using (var bulkInserter = MainDbClient.GetBulkCopy())
{
bulkInserter.DestinationTableName = uniquesReader.StorageSchema.Name;
bulkInserter.BatchSize = uniques.Length;
var fields = uniquesReader.StorageSchema.GetFieldsOrderedByIndex().Where(f => !f.Equals(StructureStorageSchema.Fields.RowId)).ToArray();
foreach (var field in fields)
bulkInserter.AddColumnMapping(field.Name, field.Name);
bulkInserter.Write(uniquesReader);
}
}
}
示例11: UniqueStorageSchema
internal UniqueStorageSchema(IStructureSchema structureSchema)
: base(structureSchema, structureSchema.GetUniquesTableName())
{
}