Esempio n. 1
0
        public static void Delete(this DirectDatabaseBase db, DirectModel model)
        {
            string command = string.Format("DELETE FROM {0}.{1}.{2} WHERE {2}ID={3};",
                                           db.DatabaseName, db.DatabaseScheme, model.GetTableName(),
                                           model.GetID());

            db.Execute(command);
        }
Esempio n. 2
0
        public static void Update(this DirectDatabaseBase db, DirectModel model)
        {
            if (model.ID() <= 0)
            {
                throw new Exception("ID is not set, maybe this table was not loaded");
            }

            // UPDATE MobilePaywall.core.A SET A=1 WHERE AID=1
            string command = string.Format("UPDATE {0}.{1}.{2} SET {3} WHERE {2}ID={4};",
                                           db.DatabaseName, db.DatabaseScheme, model.GetTableName(),
                                           model.GetUpdateData(), model.GetID());

            db.Execute(command);
        }