当前位置: 首页>>代码示例>>C#>>正文


C# IStructureSchema.GetIndexesTableName方法代码示例

本文整理汇总了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);
        }
开发者ID:darrencauthon,项目名称:SisoDb-Provider,代码行数:14,代码来源:SqlDbIndexesSchemaBuilder.cs

示例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);
            }
        }
开发者ID:darrencauthon,项目名称:SisoDb-Provider,代码行数:48,代码来源:SqlDbSchemaUpserter.cs

示例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));
                }
            }
        }
开发者ID:darrencauthon,项目名称:SisoDb-Provider,代码行数:16,代码来源:SqlDbSchemaManager.cs

示例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);
        }
开发者ID:darrencauthon,项目名称:SisoDb-Provider,代码行数:18,代码来源:SqlDbIndexesSchemaSynchronizer.cs

示例5: IndexStorageSchema

 internal IndexStorageSchema(IStructureSchema structureSchema)
     : base(structureSchema, structureSchema.GetIndexesTableName())
 {
 }
开发者ID:darrencauthon,项目名称:SisoDb-Provider,代码行数:4,代码来源:IndexStorageSchema.cs

示例6: GetIndexesColumns

        private IList<SqlDbColumn> GetIndexesColumns(IStructureSchema structureSchema)
        {
            var dbColumns = _dbClient.GetColumns(structureSchema.GetIndexesTableName(), IndexStorageSchema.Fields.StructureId.Name);

            return dbColumns ?? new List<SqlDbColumn>();
        }
开发者ID:darrencauthon,项目名称:SisoDb-Provider,代码行数:6,代码来源:SqlDbIndexesSchemaSynchronizer.cs


注:本文中的IStructureSchema.GetIndexesTableName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。