Пример #1
0
        public static TKey GetScalar <T, TKey>(this IDbCommand dbCmd, SqlExpressionVisitor <T> expression)
            where T : new()
        {
            string sql = expression.ToSelectStatement();

            return(dbCmd.GetScalar <TKey>(sql));
        }
Пример #2
0
        public static T FirstOrDefault <T>(this IDbCommand dbCmd, SqlExpressionVisitor <T> expression)
        {
            string sql = expression.ToSelectStatement();

            using (var dbReader = dbCmd.ExecReader(sql))
            {
                return(ConvertTo <T>(dbReader));
            }
        }
Пример #3
0
        public static List <T> Select <T>(this IDbCommand dbCmd, SqlExpressionVisitor <T> expression)
        {
            string sql = expression.ToSelectStatement();

            using (var reader = dbCmd.ExecReader(sql))
            {
                return(ConvertToList <T>(reader));
            }
        }