本文整理汇总了C#中IDatabaseFactory.CreateDataAdapter方法的典型用法代码示例。如果您正苦于以下问题:C# IDatabaseFactory.CreateDataAdapter方法的具体用法?C# IDatabaseFactory.CreateDataAdapter怎么用?C# IDatabaseFactory.CreateDataAdapter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDatabaseFactory
的用法示例。
在下文中一共展示了IDatabaseFactory.CreateDataAdapter方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DataSetModel
public DataSetModel(DatabaseInfo targetDatabase, IShellContext context, IDatabaseFactory factory)
{
_targetDatabase = targetDatabase;
_context = context;
_factory = factory;
_dda = _factory.CreateDataAdapter();
}
示例2: GetCommands
//public void SaveToXml(XmlElement xml)
//{
// foreach (var elem in Inserts)
// {
// elem.SaveToXml(xml.AddChild("Insert"));
// }
// foreach (var elem in Updates)
// {
// elem.SaveToXml(xml.AddChild("Update"));
// }
// foreach (var elem in Deletes)
// {
// elem.SaveToXml(xml.AddChild("Delete"));
// }
//}
//private void DumpTarget(ISqlDumper dmp, ChangeSetItem item)
//{
// string linkedInfoStr = item.LinkedInfo != null ? item.LinkedInfo.ToString() : "";
// dmp.Put("%s%f", linkedInfoStr, item.TargetTable);
//}
//private void DumpWhere(ISqlDumper dmp, ChangeSetItem item, List<ChangeSetCondition> conditions, DatabaseInfo db)
//{
// dmp.Put("^ where ");
// bool wasCond = false;
// foreach(var cond in conditions)
// {
// if (wasCond) dmp.Put(" ^and ");
// wasCond = true;
// DumpCondition(dmp, item, cond, db);
// }
//}
public DmlfBatch GetCommands(DatabaseInfo db, IDatabaseFactory factory)
{
var disableFks = new HashSet<Tuple<NameWithSchema, string>>();
var dda = factory.CreateDataAdapter();
var converter = new CdlValueConvertor(new DataFormatSettings());
foreach (var upd in Updates)
{
if (upd.DisableReferencedForeignKeys || upd.UpdateReferences || DisableReferencedForeignKeys || UpdateReferences)
{
var table = db.FindTable(upd.TargetTable);
if (table == null) continue;
foreach (var fk in table.GetReferences())
{
disableFks.Add(Tuple.Create(fk.OwnerTable.FullName, fk.ConstraintName));
}
}
}
var res = new DmlfBatch();
foreach (var fk in disableFks) res.DisableConstraint(fk.Item1, fk.Item2, true);
foreach (var ins in Inserts)
{
ins.GetCommands(res, db, dda, converter);
}
foreach (var upd in Updates)
{
upd.GetInsertCommands(res, db, this, dda, converter);
}
foreach (var upd in Updates)
{
upd.GetCommands(res, db, this, dda, converter);
}
foreach (var upd in Updates)
{
upd.GetDeleteCommands(res, db, this);
}
foreach (var del in Deletes)
{
del.GetCommands(res, db, this);
}
foreach (var fk in disableFks) res.DisableConstraint(fk.Item1, fk.Item2, false);
res.Commands.ForEach(x =>
{
var cmd = x as DmlfCommandBase;
if (cmd != null) cmd.SimplifyFromAliases();
});
return res;
}
示例3: SqlDumper
public SqlDumper(ISqlOutputStream stream, IDatabaseFactory factory, SqlFormatProperties props)
{
m_stream = stream;
m_props = props;
m_factory = factory;
m_DDA = m_factory.CreateDataAdapter();
m_formatterState.DDA = m_DDA;
m_dialect = m_factory.CreateDialect();
}
示例4: RecordToDbAdapter
public RecordToDbAdapter(TargetColumnMap columnMap, IDatabaseFactory targetFactory, DataFormatSettings formatSettings)
{
_columnMap = columnMap;
_dda = targetFactory.CreateDataAdapter();
_outputConv = new CdlValueConvertor(formatSettings);
}
示例5: Format
public static string Format(IDatabaseFactory factory, SqlFormatProperties props, SqlFormatterState state, string format, params object[] args)
{
IDialectDataAdapter dda = null;
if (state != null) dda = state.DDA;
if (dda == null) dda = factory.CreateDataAdapter();
var dialect = factory.CreateDialect();
int argindex = 0;
StringBuilder sb = new StringBuilder();
int i = 0;
while (i < format.Length)
{
char c = format[i];
switch (c)
{
case '^': // SQL keyword
{
i++;
DumpSeparatorIfNeeded(sb, props, state);
while (i < format.Length && (Char.IsLetter(format, i) || format[i] == '_'))
{
sb.Append(GetCasedChar(format[i], props.SqlCommandCase));
i++;
}
DataDumped(state);
}
break;
case '&': // indentation & spacing
{
i++;
c = format[i];
i++;
char level = '0';
if (c == '1' || c == '2' || c == '3' || c == '5')
{
level = c;
c = format[i];
i++;
}
if (level != '0')
{
// indentation levels
if (props.IndentationLevel == SqlIndentationLevel.Original || props.IndentationLevel == SqlIndentationLevel.SingleLine)
{
if (c == 'n' || c == 's')
{
if (state != null)
{
state.SeparatorNeeded = true;
}
else
{
sb.Append(" ");
}
}
// when original indentation is used, don't use our separators
break;
}
bool valid = (props.IndentationLevel == SqlIndentationLevel.Compact && (level == '2' || level == '5'))
|| (props.IndentationLevel == SqlIndentationLevel.Large && (level == '3' || level == '5'));
if (!valid)
{
break; // mark is not for this indentation level
}
}
switch (c)
{
case '&':
sb.Append("&");
break;
case 'n':
if (state == null) DumpEoln(sb, props, state);
else state.LineFeedNeeded = true;
break;
case '>':
if (state != null) state.IndentLevel++;
break;
case '<':
if (state != null) state.IndentLevel--;
break;
case 's':
if (state != null) state.SeparatorNeeded = true;
else sb.Append(" ");
break;
case 'r':
DumpSeparatorIfNeeded(sb, props, state);
break;
case 'd':
DataDumped(state);
break;
default:
throw new InternalError("DBSH-00042 Unknown & formatting instruction:" + c);
}
}
break;
case '%': // format parameter
{
i++;
c = format[i];
//.........这里部分代码省略.........