public override SqlColumnValuePair Add(string name, object value) { var pair = base.Add(name, value); pair.Field.Primary = PrimaryKeys != null && PrimaryKeys.Contains(name); pair.Field.Identity = IdentityKeys != null && IdentityKeys.Contains(name); return(pair); }
private string Condition() { if (!string.IsNullOrEmpty(Where)) { return(Where); } if (PrimaryKeys.Length > 0) { var C1 = columns.Where(c => PrimaryKeys.Contains(c.ColumnName)); var L1 = string.Join(" AND ", C1.Select(c => c.ToString())); return(L1); } return(string.Empty); }
public string Update() { var C2 = columns.Where(c => !PrimaryKeys.Contains(c.ColumnName) && !notUpdateColumns.Contains(c.ColumnName)); var L2 = string.Join(",", C2.Select(c => c.ToString())); if (C2.Count() == 0) { return(string.Empty); } string where = Condition(); if (string.IsNullOrEmpty(where)) { return(template.Update(L2)); } return(template.Update(L2, where)); }