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

C# AbstractConnection类代码示例

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

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



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


示例16: ElasticSearchEntityOutputKeysExtract

 public ElasticSearchEntityOutputKeysExtract(AbstractConnection connection, Entity entity) {
     _aliasTypes = entity.PrimaryKey.AliasTypes().ToList();
     if (entity.Version != null) {
         _aliasTypes.Add(new AliasType() { Alias = entity.Version.Alias, AliasLower = entity.Version.Alias.ToLower(), SimpleType = entity.Version.SimpleType });
     }
     _sourceInclude = _aliasTypes.Select(at => at.AliasLower).ToArray();
     _client = new ElasticSearchClientFactory().Create(connection, entity);
 }
开发者ID:modulexcite,项目名称:Transformalize,代码行数:8,代码来源:ElasticSearchEntityOutputKeysExtract.cs


示例17: ElasticSearchEntityExtract

        public ElasticSearchEntityExtract(AbstractConnection connection, Entity entity, IEnumerable<string> fields, bool correspondingKeys = false) {
            _entity = entity;
            _correspondingKeys = correspondingKeys;

            _fields = fields.Select(a => a.ToLower()).ToArray(); //for now
            _client = new ElasticSearchClientFactory().CreateNest(connection, entity);
            Name = string.Format("ElasticsearchEntityExtract ({0}:{1})", _client.Index, _client.Type);
        }
开发者ID:modulexcite,项目名称:Transformalize,代码行数:8,代码来源:ElasticSearchEntityExtract.cs


示例18: SqlEntityKeysExtractAllFromOutput

 public SqlEntityKeysExtractAllFromOutput(AbstractConnection connection, Entity entity)
     : base(connection) {
     _entity = entity;
     EntityName = entity.Name;
     _keys = _entity.Delete && _entity.IsMaster() ?
         new List<string>(entity.PrimaryKey.Aliases()) { "TflDeleted", "TflKey" } :
         new List<string>(entity.PrimaryKey.Aliases()) { "TflKey" };
 }
开发者ID:modulexcite,项目名称:Transformalize,代码行数:8,代码来源:SqlEntityKeysExtractAllFromOutput.cs


示例19: Check

 public bool Check(AbstractConnection connection) {
     var fileInfo = new FileInfo(connection.File);
     if (!fileInfo.Exists) {
         _logger.Warn("File {0} does not exist.  Creating it.", fileInfo.Name);
         System.IO.File.Create(fileInfo.FullName).Dispose();
     }
     return true;
 }
开发者ID:modulexcite,项目名称:Transformalize,代码行数:8,代码来源:FileConnectionChecker.cs


示例20: SolrEntityOutputKeysExtract

 public SolrEntityOutputKeysExtract(AbstractConnection connection, Entity entity) {
     _entity = entity;
     _aliasTypes = _entity.PrimaryKey.AliasTypes().ToList();
     if (_entity.Version != null) {
         _aliasTypes.Add(new AliasType() { Alias = _entity.Version.Alias, AliasLower = _entity.Version.Alias.ToLower(), SimpleType = _entity.Version.SimpleType });
     }
     _sourceInclude = _aliasTypes.Select(at => at.AliasLower).ToArray();
 }
开发者ID:modulexcite,项目名称:Transformalize,代码行数:8,代码来源:SolrEntityOutputKeysExtract.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# AbstractDataMappingContext类代码示例发布时间:2022-05-24
下一篇:
C# AbsoluteTopicName类代码示例发布时间: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