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


C# IDatabaseFactory.CreateDumper方法代码示例

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


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

示例1: SqlScriptCompiler

        public SqlScriptCompiler(IDatabaseFactory factory, DataSyncSqlModel datasync, IShellContext context, string procName)
        {
            _context = context;
            _procName = procName;
            _datasync = datasync;
            _factory = factory;

            _sw = new StringWriter();
            var so = new SqlOutputStream(factory.CreateDialect(), _sw, new SqlFormatProperties());
            so.OverrideCommandDelimiter(";");
            _dmp = factory.CreateDumper(so, new SqlFormatProperties());
        }
开发者ID:dbshell,项目名称:dbshell,代码行数:12,代码来源:SqlScriptCompiler.cs

示例2: GenerateSql

 public static string GenerateSql(IDatabaseFactory factory, Action<ISqlDumper> func)
 {
     var sw = new StringWriter();
     var so = new SqlOutputStream(factory.CreateDialect(), sw, new SqlFormatProperties());
     var dmp = factory.CreateDumper(so, new SqlFormatProperties());
     func(dmp);
     return sw.ToString();
 }
开发者ID:dbshell,项目名称:dbshell,代码行数:8,代码来源:SqlDumper_FmtUtils.cs

示例3: FreeExternalSources

        private void FreeExternalSources(DbConnection conn, IDatabaseFactory factory, IShellContext context)
        {
            if (!_externalSources.Any()) return;

            var sw = new StringWriter();
            var so = new ConnectionSqlOutputStream(conn, null, factory.CreateDialect());
            var dmp = factory.CreateDumper(so, new SqlFormatProperties());

            foreach (var exSource in _externalSources)
            {
                var tbl = new TableInfo(null) { FullName = exSource.ExternalDataName };
                dmp.DropTable(tbl, false);
            }
        }
开发者ID:dbshell,项目名称:dbshell,代码行数:14,代码来源:DataSyncSqlModel.cs

示例4: ToSql

 public static string ToSql(this IDmlfNode node, IDatabaseFactory factory)
 {
     if (factory == null) return "";
     var sw = new StringWriter();
     var dmp = factory.CreateDumper(new SqlOutputStream(factory.CreateDialect(), sw, SqlFormatProperties.Default), SqlFormatProperties.Default);
     node.GenSql(dmp);
     return sw.ToString();
 }
开发者ID:dbshell,项目名称:dbshell,代码行数:8,代码来源:DmlfExtension.cs

示例5: FillExternalSources

        private void FillExternalSources(DbConnection conn, IDatabaseFactory factory, IShellContext context)
        {
            if (!_externalSources.Any()) return;

            var sw = new StringWriter();
            var so = new ConnectionSqlOutputStream(conn, null, factory.CreateDialect());
            var dmp = factory.CreateDumper(so, new SqlFormatProperties());

            foreach (var exSource in _externalSources)
            {
                var tbl = new TableInfo(null) { FullName = exSource.ExternalDataName };
                foreach (var col in exSource.Dbsh.Columns)
                {
                    tbl.Columns.Add(new ColumnInfo(tbl)
                    {
                        Name = col.Name,
                        DataType = col.DataType ?? "nvarchar(500)",
                        CommonType = DbTypeBase.ParseType(col.DataType ?? "nvarchar(500)"),
                    });
                }
                dmp.CreateTable(tbl);

                var filterModel = FilterJoinSqlModel.Create(exSource, SourceGraphModel, factory);

                var copyTable = new DbShell.Core.CopyTable
                {
                    Source = filterModel?.DataSource ?? exSource.Dbsh.DataSource,
                    Target = new DbShell.Core.Table
                    {
                        Name = exSource.ExternalDataName.Name,
                        StructureOverride = tbl,
                    },
                    AllowBulkCopy = _model.AllowBulkCopy,
                };
                var runnable = (IRunnable)copyTable;
                runnable.Run(context);

                if (exSource.Dbsh.OnExternalFilledAssertion != null)
                {
                    string value = conn.ExecuteScalar(exSource.Dbsh.OnExternalFilledAssertion.Replace("${TABLE}", exSource.ExternalDataName.Name))?.ToString();
                    if (value != exSource.Dbsh.OnExternalFilledRequiredValue)
                    {
                        throw new Exception($"DBSH-00000 OnExternalFilledAssertion failed, source={exSource.SqlAlias}, required={exSource.Dbsh.OnExternalFilledRequiredValue}, actual={value}, query={exSource.Dbsh.OnExternalFilledAssertion}");
                    }
                }
            }
        }
开发者ID:dbshell,项目名称:dbshell,代码行数:47,代码来源:DataSyncSqlModel.cs


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