本文整理汇总了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());
}
示例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();
}
示例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);
}
}
示例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();
}
示例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}");
}
}
}
}