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


C# AbstractConnection.Enclose方法代码示例

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


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

示例1: SqlServerBulkLoadOperation

        public SqlServerBulkLoadOperation(AbstractConnection connection, Entity entity)
            : base(connection, connection.Enclose(entity.OutputName())) {
            _entity = entity;
            _batchSize = connection.BatchSize;
            UseTransaction = false;

            TurnOptionOn(SqlBulkCopyOptions.TableLock);
            TurnOptionOn(SqlBulkCopyOptions.UseInternalTransaction);
            TurnOptionOff(SqlBulkCopyOptions.CheckConstraints);
            TurnOptionOff(SqlBulkCopyOptions.FireTriggers);
            TurnOptionOn(SqlBulkCopyOptions.KeepNulls);
        }
开发者ID:modulexcite,项目名称:Transformalize,代码行数:12,代码来源:SqlServerBulkLoadOperation.cs

示例2: Create

        public override void Create(AbstractConnection connection, Process process, Entity entity) {

            if (EntityExists != null && EntityExists.Exists(connection, entity)) {
                process.Logger.EntityWarn(entity.Name,"Trying to create entity that already exists! {0}", entity.Name);
                return;
            }

            var keyType = entity.IsMaster() ? FieldType.MasterKey : FieldType.PrimaryKey;

            var writer = process.StarEnabled && keyType == FieldType.MasterKey ?
                new FieldSqlWriter(entity.Fields, entity.CalculatedFields, process.CalculatedFields, GetRelationshipFields(process.Relationships, entity)) :
                new FieldSqlWriter(entity.Fields, entity.CalculatedFields);

            var primaryKey = writer.FieldType(keyType).Alias(connection.L, connection.R).Asc().Values();
            var defs = new List<string>();
            defs.AddRange(writer
                .Reload()
                .AddBatchId(entity.Index)
                .AddDeleted(entity)
                .AddSurrogateKey(entity.Index)
                .Output()
                .Alias(connection.L, connection.R)
                .DataType(new SqlServerDataTypeService())
                .AppendIf(" NOT NULL", keyType)
                .Values());

            var rowVersion = entity.Fields.WithSimpleType("rowversion").WithoutInput().WithoutOutput();
            if (rowVersion.Any()) {
                var alias = rowVersion.First().Alias;
                defs.Add(connection.Enclose(alias) + " [ROWVERSION] NOT NULL");
            }

            var createSql = connection.TableQueryWriter.CreateTable(entity.OutputName(), defs);
            _logger.EntityDebug(entity.Name, createSql);

            var indexSql = connection.TableQueryWriter.AddUniqueClusteredIndex(entity.OutputName());
            _logger.EntityDebug(entity.Name, indexSql);

            var keySql = connection.TableQueryWriter.AddPrimaryKey(entity.OutputName(), primaryKey);
            _logger.EntityDebug(entity.Name, keySql);

            using (var cn = connection.GetConnection()) {
                cn.Open();
                cn.Execute(createSql);
                cn.Execute(indexSql);
                cn.Execute(keySql);
                _logger.EntityInfo(entity.Name, "Initialized {0} in {1} on {2}.", entity.OutputName(), connection.Database, connection.Server);
            }
        }
开发者ID:modulexcite,项目名称:Transformalize,代码行数:49,代码来源:SqlServerEntityCreator.cs

示例3: WriteTemporary

 public string WriteTemporary(AbstractConnection connection, string name, Fields fields, bool useAlias = true) {
     var safeName = connection.Enclose(name.TrimStart("@".ToCharArray()));
     var defs = useAlias ? new FieldSqlWriter(fields).Alias(connection.L, connection.R).DataType(new MySqlDataTypeService()).Write() : new FieldSqlWriter(fields).Name(connection.L, connection.R).DataType(new MySqlDataTypeService()).Write();
     return string.Format(@"CREATE TEMPORARY TABLE IF NOT EXISTS {0}({1}) ENGINE = MEMORY; TRUNCATE TABLE {0};", safeName, defs);
 }
开发者ID:modulexcite,项目名称:Transformalize,代码行数:5,代码来源:MySqlTableQueryWriter.cs


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