public virtual IEnumerable <T> Find(Expression <Func <T, bool> > predicate)
        {
            IEnumerable <T> items = null;

            // extract the dynamic sql query and parameters from predicate
            QueryResult result = DynamicQuery.GetDynamicQuery(_tableName, predicate);

            using (IDbConnection cn = Connection)
            {
                cn.Open();
                var          x     = (object)result.Param;
                SqlParameter param = new SqlParameter();
                param.ParameterName = "@Login";
                param.Value         = "ads";
                items = cn.Query <T>(result.Sql, (object)result.Param);
            }

            return(items);
        }
Exemplo n.º 2
0
        public static T Insert <T>(this IDbConnection cnn, string tableName, dynamic param)
        {
            IEnumerable <T> result = SqlMapper.Query <T>(cnn, DynamicQuery.GetInsertQuery(tableName, param), param);

            return(result.First());
        }
Exemplo n.º 3
0
 public static void Update(this IDbConnection cnn, string tableName, dynamic param)
 {
     SqlMapper.Execute(cnn, DynamicQuery.GetUpdateQuery(tableName, param), param);
 }