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


C# IStructureSchema.GetStructureTableName方法代码示例

本文整理汇总了C#中IStructureSchema.GetStructureTableName方法的典型用法代码示例。如果您正苦于以下问题:C# IStructureSchema.GetStructureTableName方法的具体用法?C# IStructureSchema.GetStructureTableName怎么用?C# IStructureSchema.GetStructureTableName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IStructureSchema的用法示例。


在下文中一共展示了IStructureSchema.GetStructureTableName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetJsonByIds

        public override IEnumerable<string> GetJsonByIds(IEnumerable<IStructureId> ids, IStructureSchema structureSchema)
        {
            Ensure.That(structureSchema, "structureSchema").IsNotNull();
            var sqlFormat = SqlStatements.GetSql("GetJsonByIds").Inject(structureSchema.GetStructureTableName(), "{0}");

            using (var cmd = CreateCommand(string.Empty))
            {
                foreach (var batchedIds in ids.Batch<IStructureId, IDacParameter>(MaxBatchedIdsSize, (id, batchCount) => new DacParameter(string.Concat("id", batchCount), id.Value)))
                {
                    cmd.Parameters.Clear();
                    Driver.AddCommandParametersTo(cmd, batchedIds);

                    var paramsString = string.Join(",", batchedIds.Select(p => p.Name));
                    cmd.CommandText = sqlFormat.Inject(paramsString);

                    using (var reader = cmd.ExecuteReader(CommandBehavior.SingleResult | CommandBehavior.SequentialAccess))
                    {
                        while (reader.Read())
                        {
                            yield return reader.GetString(0);
                        }
                        reader.Close();
                    }
                }
            }
        }
开发者ID:MikaelEliasson,项目名称:SisoDb-Provider,代码行数:26,代码来源:Sql2005DbClient.cs

示例2: GenerateSql

		public string[] GenerateSql(IStructureSchema structureSchema, IndexesTableNames names, IndexesTableStatuses statuses)
		{
			if(statuses.AllExists)
				return new string[0];

			var structureTableName = structureSchema.GetStructureTableName();
			var sqlTemplateNameSuffix = GetSqlTemplateNameSuffix(structureSchema.IdAccessor.IdType);
			var generators = new Func<string>[]
			{
				() => !statuses.IntegersTableExists 
					? GenerateSqlFor("CreateIntegersIndexes", sqlTemplateNameSuffix, structureTableName, names.IntegersTableName) 
					: string.Empty,
				() => !statuses.FractalsTableExists 
					? GenerateSqlFor("CreateFractalsIndexes", sqlTemplateNameSuffix, structureTableName, names.FractalsTableName) 
					: string.Empty,
				() => !statuses.BooleansTableExists 
					? GenerateSqlFor("CreateBooleansIndexes", sqlTemplateNameSuffix, structureTableName, names.BooleansTableName) 
					: string.Empty,
				() => !statuses.DatesTableExists 
					? GenerateSqlFor("CreateDatesIndexes", sqlTemplateNameSuffix, structureTableName, names.DatesTableName) 
					: string.Empty,
				() => !statuses.GuidsTableExists 
					? GenerateSqlFor("CreateGuidsIndexes", sqlTemplateNameSuffix, structureTableName, names.GuidsTableName) 
					: string.Empty,
				() => !statuses.StringsTableExists 
					? GenerateSqlFor("CreateStringsIndexes", sqlTemplateNameSuffix, structureTableName, names.StringsTableName) 
					: string.Empty,
				() => !statuses.TextsTableExists 
					? GenerateSqlFor("CreateTextsIndexes", sqlTemplateNameSuffix, structureTableName, names.TextsTableName) 
					: string.Empty
			};

			return generators.Select(generator => generator()).Where(s => !string.IsNullOrWhiteSpace(s)).ToArray();
		}
开发者ID:MikaelEliasson,项目名称:SisoDb-Provider,代码行数:34,代码来源:SqlDbIndexesSchemaBuilder.cs

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

示例4: DeleteById

        public override void DeleteById(IStructureId structureId, IStructureSchema structureSchema)
        {
            Ensure.That(structureSchema, "structureSchema").IsNotNull();

            var sql = SqlStatements.GetSql("DeleteById").Inject(structureSchema.GetStructureTableName());

            using (var cmd = CreateCommand(sql, new DacParameter("id", structureId.Value)))
            {
                cmd.ExecuteNonQuery();
            }
        }
开发者ID:BlackMael,项目名称:SisoDb-Provider,代码行数:11,代码来源:Sql2008DbClient.cs

示例5: 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

示例6: GenerateSql

        public string GenerateSql(IStructureSchema structureSchema)
        {
            var isValidIdType = structureSchema.IdAccessor.IdType == IdTypes.Guid || structureSchema.IdAccessor.IdType == IdTypes.Identity;
            if (!isValidIdType)
                throw new NotSupportedException(
                   ExceptionMessages.DbSchemaUpserter_Upsert_IdTypeNotSupported.Inject(structureSchema.IdAccessor.IdType));

            var tableName = structureSchema.GetStructureTableName();
            var sql = structureSchema.IdAccessor.IdType == IdTypes.Guid
                          ? _sqlStrings.GetSql("CreateStructuresGuid")
                          : _sqlStrings.GetSql("CreateStructuresIdentity");

            return sql.Inject(tableName);
        }
开发者ID:darrencauthon,项目名称:SisoDb-Provider,代码行数:14,代码来源:SqlDbStructuresSchemaBuilder.cs

示例7: GenerateSql

		public string GenerateSql(IStructureSchema structureSchema)
		{
			var tableName = structureSchema.GetStructureTableName();

			if (structureSchema.IdAccessor.IdType == StructureIdTypes.String)
				return _sqlStatements.GetSql("CreateStructuresString").Inject(tableName);

			if (structureSchema.IdAccessor.IdType == StructureIdTypes.Guid)
				return _sqlStatements.GetSql("CreateStructuresGuid").Inject(tableName);

			if (structureSchema.IdAccessor.IdType.IsIdentity())
				return _sqlStatements.GetSql("CreateStructuresIdentity").Inject(tableName);

			throw new SisoDbException(ExceptionMessages.SqlDbStructureSchemaBuilder_GenerateSql.Inject(structureSchema.IdAccessor.IdType));
		}
开发者ID:MikaelEliasson,项目名称:SisoDb-Provider,代码行数:15,代码来源:SqlDbStructuresSchemaBuilder.cs

示例8: 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

示例9: DeleteByIds

        public override void DeleteByIds(IEnumerable<IStructureId> ids, IStructureSchema structureSchema)
        {
            Ensure.That(structureSchema, "structureSchema").IsNotNull();

            var sql = SqlStatements.GetSql("DeleteByIds").Inject(structureSchema.GetStructureTableName());

            using (var cmd = CreateCommand(sql))
            {
            	foreach (var idBatch in ids.Batch(MaxBatchedIdsSize))
            	{
					cmd.Parameters.Clear();
					cmd.Parameters.Add(Sql2008IdsTableParam.CreateIdsTableParam(structureSchema.IdAccessor.IdType, idBatch));
					cmd.ExecuteNonQuery();	
            	}
            }
        }
开发者ID:BlackMael,项目名称:SisoDb-Provider,代码行数:16,代码来源:Sql2008DbClient.cs

示例10: 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

示例11: DeleteByIds

        public override void DeleteByIds(IEnumerable<IStructureId> ids, IStructureSchema structureSchema)
        {
            Ensure.That(structureSchema, "structureSchema").IsNotNull();
            var sqlFormat = SqlStatements.GetSql("DeleteByIds").Inject(structureSchema.GetStructureTableName(), "{0}");

            using (var cmd = CreateCommand(string.Empty))
            {
                foreach (var batchedIds in ids.Batch<IStructureId, IDacParameter>(MaxBatchedIdsSize, (id, batchCount) => new DacParameter(string.Concat("id", batchCount), id.Value)))
                {
                    cmd.Parameters.Clear();
                    Driver.AddCommandParametersTo(cmd, batchedIds);

                    var paramsString = string.Join(",", batchedIds.Select(p => p.Name));
                    cmd.CommandText = sqlFormat.Inject(paramsString);
                    cmd.ExecuteNonQuery();
                }
            }
        }
开发者ID:MikaelEliasson,项目名称:SisoDb-Provider,代码行数:18,代码来源:Sql2005DbClient.cs

示例12: GetJsonByIds

        public override IEnumerable<string> GetJsonByIds(IEnumerable<IStructureId> ids, IStructureSchema structureSchema)
        {
            Ensure.That(structureSchema, "structureSchema").IsNotNull();

            var sql = SqlStatements.GetSql("GetJsonByIds").Inject(structureSchema.GetStructureTableName());

            using (var cmd = CreateCommand(sql))
            {
				foreach (var idBatch in ids.Batch(MaxBatchedIdsSize))
				{
					cmd.Parameters.Clear();
                    cmd.Parameters.Add(SqlServerIdsTableParam.CreateIdsTableParam(structureSchema.IdAccessor.IdType, idBatch));

				    foreach (var data in YieldJson(structureSchema, cmd))
				        yield return data;
				}
            }
        }
开发者ID:ovuncgursoy,项目名称:SisoDb-Provider,代码行数:18,代码来源:SqlServerDbClient.cs

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

示例14: GetJsonByIds

        public override IEnumerable<string> GetJsonByIds(IEnumerable<IStructureId> ids, IStructureSchema structureSchema)
        {
            Ensure.That(structureSchema, "structureSchema").IsNotNull();

            var sql = SqlStatements.GetSql("GetJsonByIds").Inject(structureSchema.GetStructureTableName());

            using (var cmd = CreateCommand(sql))
            {
				foreach (var idBatch in ids.Batch(MaxBatchedIdsSize))
				{
					cmd.Parameters.Clear();
                    cmd.Parameters.Add(SqlServerIdsTableParam.CreateIdsTableParam(structureSchema.IdAccessor.IdType, idBatch));

					using (var reader = cmd.ExecuteReader(CommandBehavior.SingleResult | CommandBehavior.SequentialAccess))
					{
						while (reader.Read())
						{
							yield return reader.GetString(0);
						}
						reader.Close();
					}
				}
            }
        }
开发者ID:MikaelEliasson,项目名称:SisoDb-Provider,代码行数:24,代码来源:SqlServerDbClient.cs

示例15: RowCountByQuery

        public override int RowCountByQuery(IStructureSchema structureSchema, DbQuery query)
        {
            Ensure.That(structureSchema, "structureSchema").IsNotNull();

            var sql = SqlStatements.GetSql("RowCountByQuery").Inject(structureSchema.GetStructureTableName(), query.Sql);

            return ExecuteScalar<int>(sql, query.Parameters.ToArray());
        }
开发者ID:BlackMael,项目名称:SisoDb-Provider,代码行数:8,代码来源:Sql2008DbClient.cs


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