Exemplo n.º 1
0
        public static int DeleteByQuery <T>(this IDbConnection connection, Action <IRestrictable <T> > restriction)
            where T : class
        {
            var parameters = new List <object>();
            var sql        = new DeleteByQuery <T>().GetSql(restriction, parameters);

            return(AttachParamsAndRun(connection, sql, parameters));
        }
Exemplo n.º 2
0
        public void DeleteByQuery()
        {
            var deleteByQuery = new DeleteByQuery <CompositeIdSample>();
            var parameters    = new List <object>();
            var sql           = deleteByQuery.GetSql(w => w.Equal(x => x.Id1, 5), parameters);

            Assert.AreEqual("DELETE FROM `composite_id_table` WHERE (`Id1` = ?p0);", sql);
            Assert.AreEqual(5, parameters[0]);
        }