void AppendKeyCriteria(string kind, object key, StringBuilder sql, ICollection <object> parameters) { sql.Append(" where "); var compound = key as CompoundKey; var names = _keyAccess.GetKeyNames(kind); if (names.Count > 1 ^ compound != null) { throw new InvalidOperationException(); } var first = true; foreach (var name in names) { if (!first) { sql.Append(" and "); } sql.Append(QuoteName(name)).Append(" = {").Append(parameters.Count).Append("}"); if (compound != null) { parameters.Add(compound[name]); } else { parameters.Add(key); } first = false; } }
internal static string GetAutoIncrementName(this IKeyAccess keyAccess, string kind) { if (!keyAccess.IsAutoIncrement(kind)) { return(null); } return(keyAccess.GetKeyNames(kind).First()); }