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


C# IStructureSchema类代码示例

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


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

示例1: SchemaIsAllreadyUpserted

        private bool SchemaIsAllreadyUpserted(IStructureSchema structureSchema, IDbClient dbClient)
        {
            if (UpsertedSchemas.Contains(structureSchema.Name) || TransientSchemas.Contains(structureSchema.Name))
                return true;

            return (UpsertedSchemasByDbClient.ContainsKey(dbClient.Id) && UpsertedSchemasByDbClient[dbClient.Id].Contains(structureSchema.Name));
        }
开发者ID:ovuncgursoy,项目名称:SisoDb-Provider,代码行数:7,代码来源:DbSchemas.cs

示例2: Synchronize

        public void Synchronize(IStructureSchema structureSchema)
        {
            var keyNamesToDrop = GetKeyNamesToDrop(structureSchema);

            if (keyNamesToDrop.Count > 0)
                DeleteRecordsMatchingKeyNames(structureSchema, keyNamesToDrop);
        }
开发者ID:darrencauthon,项目名称:SisoDb-Provider,代码行数:7,代码来源:SqlDbUniquesSchemaSynchronizer.cs

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

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

示例5: CreateForInserts

		private IStructureBuilder CreateForInserts(IStructureSchema structureSchema, IIdentityStructureIdGenerator identityStructureIdGenerator)
		{
			Ensure.That(structureSchema, "structureSchema").IsNotNull();
			Ensure.That(identityStructureIdGenerator, "identityStructureIdGenerator").IsNotNull();

            var idType = structureSchema.IdAccessor.IdType;

            if (idType == StructureIdTypes.Guid)
                return new StructureBuilder
                {
                    StructureIdGenerator = new SequentialGuidStructureIdGenerator(),
                    StructureSerializer = new SerializerForStructureBuilder()
                };

            if (idType.IsIdentity())
                return new StructureBuilder
                {
					StructureIdGenerator = identityStructureIdGenerator,
                    StructureSerializer = new SerializerForStructureBuilder()
                };

            if (idType == StructureIdTypes.String)
                return new StructureBuilderPreservingId
                {
                    StructureIdGenerator = new EmptyStructureIdGenerator(),
                    StructureSerializer = new SerializerForStructureBuilder()
                };

            throw new SisoDbException(ExceptionMessages.StructureBuilders_CreateForInsert.Inject(idType, structureSchema.Name));
        }
开发者ID:BlackMael,项目名称:SisoDb-Provider,代码行数:30,代码来源:StructureBuilders.cs

示例6: CheckOutAndGetSeed

 public int CheckOutAndGetSeed(IStructureSchema structureSchema, int numOfIds)
 {
     using(var dbClient = new SqlDbClient(_connectionInfo, false))
     {
         return dbClient.GetIdentity(structureSchema.Hash, numOfIds);
     }
 }
开发者ID:darrencauthon,项目名称:SisoDb-Provider,代码行数:7,代码来源:SqlIdentityGenerator.cs

示例7: Generate

        public IStructureId[] Generate(IStructureSchema structureSchema, int numOfIds)
        {
            if (structureSchema.IdAccessor.IdType == StructureIdTypes.Identity)
                return GenerateIdentityStructureId(structureSchema, numOfIds);

            return GenerateBigIdentityStructureId(structureSchema, numOfIds);
        }
开发者ID:BlackMael,项目名称:SisoDb-Provider,代码行数:7,代码来源:DbIdentityStructureIdGenerator.cs

示例8: GetDbKeyNamesToDrop

		private string[] GetDbKeyNamesToDrop(IStructureSchema structureSchema, IDbClient dbClient)
        {
            var structureFields = new HashSet<string>(structureSchema.IndexAccessors.Select(iac => iac.Path));
            var keyNames = GetExistingDbKeyNames(structureSchema, dbClient);

            return keyNames.Where(kn => !structureFields.Contains(kn)).ToArray();
        }
开发者ID:ovuncgursoy,项目名称:SisoDb-Provider,代码行数:7,代码来源:SqlDbUniquesSchemaSynchronizer.cs

示例9: RemoveFromCache

        public virtual void RemoveFromCache(IStructureSchema structureSchema)
		{
			lock (_upsertedSchemas)
			{
				_upsertedSchemas.Remove(structureSchema.Name);
			}
		}
开发者ID:MikaelEliasson,项目名称:SisoDb-Provider,代码行数:7,代码来源:DbSchemaManager.cs

示例10: Insert

        public virtual void Insert(IStructureSchema structureSchema, IStructure[] structures)
        {
            var groupedIndexInsertActions = new IndexInsertAction[0];

            Task task = null;
            try
            {
                task = Task.Factory.StartNew(
                    () => groupedIndexInsertActions = CreateGroupedIndexInsertActions(structureSchema, structures));

                InsertStructures(structureSchema, structures);
                InsertUniques(structureSchema, structures);

                Task.WaitAll(task);
            }
            finally
            {
                if (task != null && task.Status == TaskStatus.RanToCompletion)
                    task.Dispose();
            }

            if (!groupedIndexInsertActions.Any())
                return;

            InsertIndexes(groupedIndexInsertActions);
        }
开发者ID:ovuncgursoy,项目名称:SisoDb-Provider,代码行数:26,代码来源:DbStructureInserter.cs

示例11: Synchronize

		public void Synchronize(IStructureSchema structureSchema, IDbClient dbClient)
        {
            var keyNamesToDrop = GetDbKeyNamesToDrop(structureSchema, dbClient);

            if (keyNamesToDrop.Any())
                DeleteRecordsMatchingKeyNames(structureSchema, keyNamesToDrop, dbClient);
        }
开发者ID:ovuncgursoy,项目名称:SisoDb-Provider,代码行数:7,代码来源:SqlDbUniquesSchemaSynchronizer.cs

示例12: Query

		public Query(IStructureSchema structureSchema)
		{
			Ensure.That(structureSchema, "structureSchema").IsNotNull();

			StructureSchema = structureSchema;
		    IsCacheable = false;
		}
开发者ID:ovuncgursoy,项目名称:SisoDb-Provider,代码行数:7,代码来源:Query.cs

示例13: GetDefaultBuilderForInserts

        public static IStructureBuilder GetDefaultBuilderForInserts(IStructureBuilders builders, IStructureSchema schema, IDbClient dbClient)
        {
            Ensure.That(builders, "builders").IsNotNull();
            Ensure.That(schema, "schema").IsNotNull();
            Ensure.That(dbClient, "dbClient").IsNotNull();

            var idType = schema.IdAccessor.IdType;
            if (idType.IsGuid())
                return new StructureBuilder
                {
                    StructureIdGenerator = builders.GuidStructureIdGeneratorFn(schema),
                    StructureSerializer = builders.StructureSerializerFn()
                };

            if (idType.IsIdentity())
                return new StructureBuilder
                {
                    StructureIdGenerator = builders.IdentityStructureIdGeneratorFn(schema, dbClient),
                    StructureSerializer = builders.StructureSerializerFn()
                };

            if (idType.IsString())
                return new StructureBuilderPreservingId
                {
                    StructureIdGenerator = new EmptyStructureIdGenerator(),
                    StructureSerializer = builders.StructureSerializerFn()
                };

            throw new SisoDbException(ExceptionMessages.StructureBuilders_CreateForInsert.Inject(idType, schema.Name));
        }
开发者ID:ovuncgursoy,项目名称:SisoDb-Provider,代码行数:30,代码来源:StructureBuildersFn.cs

示例14: GetKeyNamesToDrop

        private IList<string> GetKeyNamesToDrop(IStructureSchema structureSchema)
        {
            var structureFields = new HashSet<string>(structureSchema.IndexAccessors.Select(iac => iac.Name));
            var keyNames = GetKeyNames(structureSchema);

            return keyNames.Where(kn => !structureFields.Contains(kn)).ToList();
        }
开发者ID:darrencauthon,项目名称:SisoDb-Provider,代码行数:7,代码来源:SqlDbUniquesSchemaSynchronizer.cs

示例15: Query

		public Query(IStructureSchema structureSchema)
		{
			Ensure.That(structureSchema, "structureSchema").IsNotNull();

			StructureSchema = structureSchema;

			Includes = new List<IParsedLambda>();
		}
开发者ID:MikaelEliasson,项目名称:SisoDb-Provider,代码行数:8,代码来源:Query.cs


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