public void Delete(IDGBase vl, IDBExecutor exec) { SchemaTable t = Schema.EnsureSchema(vl.GetType()); if (t != null) { SQDeleteQuery dlt = new SQDeleteQuery() { DeleteTable = new SQAliasableObject(t.Table.Name), Condition = new SQCondition(t.Table.GetPrimaryKey().Name, SQRelationOperators.Equal, vl.ID.ToString()) }; dlt.Execute(exec); } }
public void Update(IDGBase vl, IDBExecutor exec) { SchemaTable t = Schema.EnsureSchema(vl.GetType()); if (t != null) { SQUpdateQuery upd = new SQUpdateQuery() { UpdateTable = new SQAliasableObject(t.Table.Name), Condition = new SQCondition(t.Table.GetPrimaryKey().Name, SQRelationOperators.Equal, vl.ID.ToString()) }; PopulateSetQuery(upd, vl, t); upd.Execute(exec); } }
public Int64 Insert(IDGBase vl, IDBExecutor exec) { SchemaTable t = Schema.EnsureSchema(vl.GetType()); if (t != null) { SQInsertQuery ins = new SQInsertQuery() { Table = new SQAliasableObject(t.Table.Name), ReturnID = true }; PopulateSetQuery(ins, vl, t); return(ins.ExecuteReturnID <Int64>(exec)); } return(-1); }