Пример #1
0
        public static List <T> GetAll <T>(this IDBComplete <T> db, DatabaseLogger Logger = null)
            where T : new()
        {
            var control = db.GetBControl();

            return(control.GetAll(Logger: Logger));
        }
Пример #2
0
        public static bool Delete <T>(this IDBComplete <T> db, DatabaseLogger Logger = null)
            where T : new()
        {
            var control = db.GetBControl();

            return(control.Delete(Condition: control.PrimaryKey, Logger: Logger) == 1);
        }
Пример #3
0
        public static bool Update <T>(this IDBComplete <T> db, DatabaseLogger Logger = null)
            where T : new()
        {
            var control = db.GetBControl();

            return(control.Update(!control.PrimaryKey, control.PrimaryKey, Logger) == 1);
        }
Пример #4
0
        public static bool Get <T>(this IDBComplete <T> db)
            where T : new()
        {
            var control = db.GetBControl();

            return(control.Get(Condition: control.PrimaryKey));
        }
Пример #5
0
        public static int Add <T>(this IDBComplete <T> db, DatabaseLogger Logger = null)
            where T : new()
        {
            var control = db.GetBControl();

            if (control.PrimaryKey == null)
            {
                throw new NullReferenceException("No primary key found");
            }
            int ID = control.Insert(!control.PrimaryKey, Logger);  // assign id

            control.PrimaryKey.AssignRawValue(ID);
            return(ID);
        }