本文整理汇总了C#中IDbContext.Fill方法的典型用法代码示例。如果您正苦于以下问题:C# IDbContext.Fill方法的具体用法?C# IDbContext.Fill怎么用?C# IDbContext.Fill使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDbContext
的用法示例。
在下文中一共展示了IDbContext.Fill方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetDataMapped
private static Dictionary<string, long> GetDataMapped(IDbContext context, string statement)
{
var result = new Dictionary<string, long>(32);
context.Fill(result, (r, map) => { map.Add(r.GetString(1), r.GetInt64(0)); }, new Query(statement));
return result;
}
示例2: GetVersions
private static Dictionary<long, VersionRow> GetVersions(IDbContext context, List<ExceptionEntryRow> entries)
{
var values = new Dictionary<long, VersionRow>(entries.Count);
var batchSize = 16;
var sqlParams = CreateBatchParams(batchSize);
var query = new Query(@"SELECT ID, NAME FROM FEATURE_VERSIONS WHERE ID IN (@p0,@p1,@p2,@p3,@p4,@p5,@p6,@p7,@p8,@p9,@p10,@p11,@p12,@p13,@p14,@p15)", sqlParams);
var index = 0;
foreach (var id in entries.Select(r => r.VersionId).Distinct())
{
if (index < batchSize)
{
sqlParams[index++].Value = id;
continue;
}
context.Fill(values, (r, map) =>
{
var row = new VersionRow(r.GetInt64(0), r.GetString(1));
map.Add(row.Id, row);
}, query);
sqlParams[0].Value = id;
index = 1;
}
if (index > 0)
{
for (var i = index; i < sqlParams.Length; i++)
{
sqlParams[i].Value = -1;
}
context.Fill(values, (r, map) =>
{
var row = new VersionRow(r.GetInt64(0), r.GetString(1));
map.Add(row.Id, row);
}, query);
}
return values;
}
示例3: CountByVersion
private static Dictionary<long, int> CountByVersion(IDbContext context, string query)
{
var result = new Dictionary<long, int>();
context.Fill(result, (r, map) =>
{
var versionId = r.GetInt64(0);
var count = r.GetInt32(1);
map[versionId] = count;
}, new Query(query));
return result;
}
示例4: GetContexts
public static Dictionary<string, DbFeatureContextRow> GetContexts(IDbContext context)
{
if (context == null) throw new ArgumentNullException(nameof(context));
var result = new Dictionary<string, DbFeatureContextRow>();
context.Fill(result, (r, map) =>
{
var row = DbContextCreator(r);
map.Add(row.Name, row);
}, new Query(GetContextsQuery.Statement));
return result;
}