• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IStructureSchema类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: InsertIndexesOnly

        public virtual void InsertIndexesOnly(IStructureSchema structureSchema, IStructure[] structures)
        {
            var groupedIndexInsertActions = CreateGroupedIndexInsertActions(structureSchema, structures);
            if (!groupedIndexInsertActions.Any())
                return;

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


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


示例18: CreateForUpdates

 private static IStructureBuilder CreateForUpdates(IStructureSchema structureSchema)
 {
     return new StructureBuilderPreservingId
     {
         StructureIdGenerator = new EmptyStructureIdGenerator(),
         StructureSerializer = new SerializerForStructureBuilder()
     };
 }
开发者ID:BlackMael,项目名称:SisoDb-Provider,代码行数:8,代码来源:StructureBuilders.cs


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


示例20: GetDefaultBuilderForUpdates

 protected virtual IStructureBuilder GetDefaultBuilderForUpdates(IStructureSchema structureSchema)
 {
     return new StructureBuilderPreservingId
     {
         StructureIdGenerator = new EmptyStructureIdGenerator(),
         StructureSerializer = StructureSerializerFn()
     };
 }
开发者ID:kukubadze,项目名称:SisoDb-Provider,代码行数:8,代码来源:StructureBuilders.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IStyle类代码示例发布时间:2022-05-24
下一篇:
C# IStructureReference类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap