public FeatureException(ExceptionRow row) { if (row == null) throw new ArgumentNullException(nameof(row)); this.Row = row; this.Name = row.Name; }
private static Dictionary<long, ExceptionRow> GetExceptions(IDbContext context, List<ExceptionEntryRow> entries) { var values = new Dictionary<long, ExceptionRow>(entries.Count); var batchSize = 16; var sqlParams = CreateBatchParams(batchSize); var query = new Query(@"SELECT ID, CONTENTS FROM FEATURE_EXCEPTIONS 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.ExceptionId).Distinct()) { if (index < batchSize) { sqlParams[index++].Value = id; continue; } context.Fill(values, (r, map) => { var row = new ExceptionRow(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 ExceptionRow(r.GetInt64(0), r.GetString(1)); map.Add(row.Id, row); }, query); } return values; }