Exemple #1
0
        public static void Delete()
        {
            context.Delete <User>(a => a.Id == 1);

            /*
             * DELETE FROM "USERS" WHERE "USERS"."ID" = 1
             */

            //批量删除
            //删除所有不男不女的用户
            context.Delete <User>(a => a.Gender == null);

            /*
             * DELETE FROM "USERS" WHERE "USERS"."GENDER" IS NULL
             */

            User user = new User();

            user.Id = 1;
            context.Delete(user);

            /*
             * Int32 :P_0 = 1;
             * DELETE FROM "USERS" WHERE "USERS"."ID" = :P_0
             */

            ConsoleHelper.WriteLineAndReadKey(1);
        }