예제 #1
0
        public static int DeleteFrom <T>(this IAccessDb db, Expression <Func <T, bool> > criteria = null)
        {
            var builder = new ExpressionSqlBuilder <T>(db.Provider.BuilderHelper);

            builder.WriteDelete();
            if (criteria != null)
            {
                builder.Where(criteria);
            }
            return(db.ExecuteCommand(builder.ToString(), builder.Parameters.ToArray()));
        }
예제 #2
0
        public static int DeleteFrom <T>(this DbConnection db, Expression <Func <T, bool> > criteria = null, string schemaName = null)
        {
            var builder = new ExpressionSqlBuilder <T>(db.GetProvider().BuilderHelper, schemaName);

            builder.WriteDelete();
            if (criteria != null)
            {
                builder.Where(criteria);
            }
            return(db.Execute(builder.ToString(), builder.Parameters.ToArray()));
        }