Esempio n. 1
0
        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);
            }
        }
Esempio n. 2
0
        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);
            }
        }
Esempio n. 3
0
        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);
        }