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


C# AbstractConnection类代码示例

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


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

示例1: SqlEntityDelete

 public SqlEntityDelete(AbstractConnection connection, Entity entity)
     : base(connection) {
     _name = Connection.Enclose(entity.OutputName());
     _isMaster = entity.IsMaster();
     BatchSize = connection.BatchSize;
     UseTransaction = true;
 }
开发者ID:modulexcite,项目名称:Transformalize,代码行数:7,代码来源:SqlEntityDelete.cs

示例2: WriteEndVersion

        public override void WriteEndVersion(Process process, AbstractConnection input, Entity entity, bool force = false) {
            if (entity.Updates + entity.Inserts > 0 || force) {
                var client = new ElasticSearchClientFactory().Create(this, TflBatchEntity(entity.ProcessName));
                var versionType = entity.Version == null ? "string" : entity.Version.SimpleType;

                string end;
                if (versionType.Equals("datetime") && entity.End is DateTime) {
                    end = ((DateTime)entity.End).ToString("yyyy-MM-ddTHH:mm:ss.fff");
                } else if (versionType.Equals("byte[]") || versionType.Equals("rowversion")) {
                    end = Common.BytesToHexString((byte[])entity.End);
                } else {
                    end = new DefaultFactory(Logger).Convert(entity.End, versionType).ToString();
                }

                var body = new {
                    id = entity.TflBatchId,
                    tflbatchid = entity.TflBatchId,
                    process = entity.ProcessName,
                    connection = input.Name,
                    entity = entity.Alias,
                    updates = entity.Updates,
                    inserts = entity.Inserts,
                    deletes = entity.Deletes,
                    version = end,
                    version_type = versionType,
                    tflupdate = DateTime.UtcNow
                };
                client.Client.Index(client.Index, client.Type, body);
            }
        }
开发者ID:modulexcite,项目名称:Transformalize,代码行数:30,代码来源:ElasticSearchConnection.cs

示例3: SqlServerEntityBatchUpdate

 public SqlServerEntityBatchUpdate(AbstractConnection connection, Entity entity)
     : base(connection) {
     _connection = connection;
     _entity = entity;
     BatchSize = connection.BatchSize;
     UseTransaction = true;
 }
开发者ID:modulexcite,项目名称:Transformalize,代码行数:7,代码来源:SqlServerEntityBatchUpdate.cs

示例4: Read

        public Fields Read(AbstractConnection connection, string process, string prefix, string name, string schema, bool isMaster = false) {
            var fields = new Fields();

            using (var cn = connection.GetConnection()) {
                cn.Open();
                var sql = PrepareSql();
                connection.Logger.EntityDebug(name, sql);

                var results = cn.Query(sql, new { name, schema });

                foreach (var result in results) {
                    var columnName = result.COLUMN_NAME;
                    var type = GetSystemType(result.DATA_TYPE);
                    var length = result.CHARACTER_MAXIMUM_LENGTH == "0" || result.CHARACTER_MAXIMUM_LENGTH == "-1" ? "64" : result.CHARACTER_MAXIMUM_LENGTH;
                    var fieldType = (bool)result.IS_PRIMARY_KEY ? (isMaster ? FieldType.MasterKey : FieldType.PrimaryKey) : FieldType.NonKey;
                    var field = new Field(type, length, fieldType, true, string.Empty) {
                        Name = columnName,
                        Entity = name,
                        Process = process,
                        Index = Convert.ToInt16(result.ORDINAL_POSITION - 1),
                        Schema = schema,
                        Input = true,
                        Precision = result.NUMERIC_PRECISION,
                        Scale = result.NUMERIC_SCALE,
                        Alias = prefix + columnName
                    };
                    fields.Add(field);
                }
            }

            return fields;
        }
开发者ID:modulexcite,项目名称:Transformalize,代码行数:32,代码来源:SqlServerEntityAutoFieldReader.cs

示例5: Create

 public static FSDirectory Create(AbstractConnection connection) {
     var directoryInfo = new DirectoryInfo(connection.Folder);
     if (!directoryInfo.Exists) {
         directoryInfo.Create();
     }
     return FSDirectory.Open(directoryInfo);
 }
开发者ID:mindis,项目名称:Transformalize,代码行数:7,代码来源:LuceneDirectoryFactory.cs

示例6: Exists

 public bool Exists(AbstractConnection connection, Entity entity) {
     if (!new DirectoryInfo(LuceneDirectoryFactory.Path(connection, entity)).Exists)
         return false;
     using (var dir = LuceneDirectoryFactory.Create(connection, entity)) {
         return dir.ListAll().Length > 0;
     }
 }
开发者ID:modulexcite,项目名称:Transformalize,代码行数:7,代码来源:LuceneEntityExists.cs

示例7: VistaSystemFileHandler

 public VistaSystemFileHandler(AbstractConnection cxn)
 {
     myCxn = cxn;
     getFileDefs();
     files = new Hashtable();
     lookupTables = new Hashtable();
 }
开发者ID:OSEHRA,项目名称:mdo,代码行数:7,代码来源:VistaSystemFileHandler.cs

示例8: SqlOverrideOperation

 public SqlOverrideOperation(Entity entity, AbstractConnection connection)
     : base(connection) {
     CommandBehavior = CommandBehavior.Default;
     EntityName = entity.Name;
     _entity = entity;
     _fields = entity.Fields.WithInput().NameAliases().ToArray();
 }
开发者ID:modulexcite,项目名称:Transformalize,代码行数:7,代码来源:SqlOverrideOperation.cs

示例9: Exists

 public bool Exists(AbstractConnection connection, Entity entity) {
     using (var cn = connection.GetConnection()) {
         cn.Open();
         var table = cn.Query<string>(SQL, new { name = entity.OutputName() }).DefaultIfEmpty(string.Empty).FirstOrDefault();
         return !string.IsNullOrEmpty(table);
     }
 }
开发者ID:modulexcite,项目名称:Transformalize,代码行数:7,代码来源:MySqlEntityExists.cs

示例10: Execute

        public IScriptReponse Execute(AbstractConnection connection, string script, int timeOut = 0) {
            var response = new ScriptResponse();
            var server = new Server();
            var logger = connection.Logger;

            try {
                logger.Debug("Connecting to {0} on {1}.", connection.Database, connection.Server);
                server.Connect(connection.GetConnectionString());

                var results = server.Execute(script);

                foreach (XmlaResult result in results) {
                    foreach (XmlaMessage message in result.Messages) {
                        response.Messages.Add(message.Description);
                    }
                }
                response.Success = response.Messages.Count == 0;
            } catch (Exception e) {
                logger.Debug(e.Message + (e.InnerException != null ? " " + e.InnerException.Message : string.Empty));
                response.Messages.Add(e.Message);
            } finally {
                if (server.Connected) {
                    logger.Debug("Disconnecting from {0} on {1}.", connection.Database, connection.Server);
                    server.Disconnect();
                }
            }
            return response;
        }
开发者ID:modulexcite,项目名称:Transformalize,代码行数:28,代码来源:AnalysisServicesScriptRunner.cs

示例11: WriteEndVersion

        public override void WriteEndVersion(Process process, AbstractConnection input, Entity entity, bool force = false) {

            if (entity.Updates + entity.Inserts > 0 || force) {

                var solr = GetOperations(process, entity.OutputName());
                var versionType = entity.Version == null ? "string" : entity.Version.SimpleType;

                string end;
                if (versionType.Equals("datetime") && entity.End is DateTime) {
                    end = ((DateTime)entity.End).ToString("yyyy-MM-ddTHH:mm:ss.fff");
                } else if (versionType.Equals("byte[]") || versionType.Equals("rowversion")) {
                    end = Common.BytesToHexString((byte[])entity.End);
                } else {
                    end = new DefaultFactory(Logger).Convert(entity.End, versionType).ToString();
                }

                var doc = new Dictionary<string, object> {
                    { "id", entity.TflBatchId},
                    { "tflbatchid", entity.TflBatchId},
                    { "process", entity.ProcessName},
                    { "connection", input.Name},
                    { "entity", entity.Alias},
                    { "updates", entity.Updates},
                    { "inserts", entity.Inserts},
                    { "deletes", entity.Deletes},
                    { "version", end},
                    { "version_type", versionType},
                    { "tflupdate", DateTime.UtcNow}
                };
                solr.Add(doc);
                solr.Commit();
            }
        }
开发者ID:modulexcite,项目名称:Transformalize,代码行数:33,代码来源:SolrConnection.cs

示例12: Check

 public bool Check(AbstractConnection connection) {
     var result = connection.Name.Equals("output", IC) || new DirectoryInfo(connection.Folder).Exists;
     if (!result) {
         _logger.Warn("Could not verify that '{0}' exists.", connection.Folder);
     }
     return result;
 }
开发者ID:modulexcite,项目名称:Transformalize,代码行数:7,代码来源:FolderConnectionChecker.cs

示例13: WriteEndVersion

        public override void WriteEndVersion(Process process, AbstractConnection input, Entity entity, bool force = false) {
            if (entity.Updates + entity.Inserts <= 0 && !force)
                return;

            var versionType = entity.Version == null ? "string" : entity.Version.SimpleType;
            var end = entity.End ?? new DefaultFactory(Logger).Convert(entity.End, versionType);

            using (var dir = LuceneDirectoryFactory.Create(this, TflBatchEntity(entity.ProcessName))) {
                using (var writer = new IndexWriter(dir, new KeywordAnalyzer(), IndexWriter.MaxFieldLength.UNLIMITED)) {
                    var doc = new Document();
                    doc.fields.Add(new NumericField("id", Libs.Lucene.Net.Document.Field.Store.YES, true).SetIntValue(entity.TflBatchId));
                    doc.fields.Add(new Libs.Lucene.Net.Document.Field("process", entity.ProcessName, Libs.Lucene.Net.Document.Field.Store.YES, Libs.Lucene.Net.Document.Field.Index.NOT_ANALYZED_NO_NORMS));
                    doc.fields.Add(new Libs.Lucene.Net.Document.Field("connection", input.Name, Libs.Lucene.Net.Document.Field.Store.YES, Libs.Lucene.Net.Document.Field.Index.NOT_ANALYZED_NO_NORMS));
                    doc.fields.Add(new Libs.Lucene.Net.Document.Field("entity", entity.Alias, Libs.Lucene.Net.Document.Field.Store.YES, Libs.Lucene.Net.Document.Field.Index.NOT_ANALYZED_NO_NORMS));
                    doc.fields.Add(new NumericField("updates", Libs.Lucene.Net.Document.Field.Store.YES, true).SetLongValue(entity.Updates));
                    doc.fields.Add(new NumericField("inserts", Libs.Lucene.Net.Document.Field.Store.YES, true).SetLongValue(entity.Inserts));
                    doc.fields.Add(new NumericField("deletes", Libs.Lucene.Net.Document.Field.Store.YES, true).SetLongValue(entity.Deletes));
                    doc.fields.Add(LuceneWriter.CreateField("version", versionType, new SearchType { Analyzer = "keyword" }, end));
                    doc.fields.Add(new Libs.Lucene.Net.Document.Field("version_type", versionType, Libs.Lucene.Net.Document.Field.Store.YES, Libs.Lucene.Net.Document.Field.Index.NOT_ANALYZED_NO_NORMS));
                    doc.fields.Add(new NumericField("tflupdate", Libs.Lucene.Net.Document.Field.Store.YES, true).SetLongValue(DateTime.UtcNow.Ticks));
                    writer.AddDocument(doc);
                    writer.Commit();
                    writer.Optimize();
                }
            }
        }
开发者ID:mindis,项目名称:Transformalize,代码行数:26,代码来源:LuceneConnection.cs

示例14: SqlServerEntityKeysExtractFromOutput

 public SqlServerEntityKeysExtractFromOutput(AbstractConnection connection, Entity entity)
     : base(connection) {
     _connection = connection;
     EntityName = entity.Name;
     _entity = entity;
     _fields = new List<string>(new FieldSqlWriter(entity.PrimaryKey).AddDeleted(entity).Alias(connection.L, connection.R).Keys()) { "TflKey" };
     _key = _entity.PrimaryKey;
 }
开发者ID:modulexcite,项目名称:Transformalize,代码行数:8,代码来源:SqlServerEntityKeysExtractFromOutput.cs

示例15: SqlKeysOverrideOperation

        public SqlKeysOverrideOperation(Entity entity, AbstractConnection connection)
            : base(connection) {
            _entity = entity;
            EntityName = entity.Name;
            _fields = entity.PrimaryKey.Aliases().ToArray();
            _length = _fields.Length;

            }
开发者ID:modulexcite,项目名称:Transformalize,代码行数:8,代码来源:SqlKeysOverrideOperation.cs


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