Exemple #1
0
        //public static QueryBuilder<TResult> From<TResult>(this DbConnection connection, ICommandBuilder commandBuilder = null) where TResult : class, new()
        //{
        //    return From<TResult>(connection, (TableOrSubQuery)null, (ICommandBuilder)null);
        //}

        public static QueryBuilder <TResult> From <TResult>(this DbConnection connection, TableOrSubQuery source = null, ICommandBuilder commandBuilder = null) where TResult : class, new()
        {
            commandBuilder = commandBuilder ?? DefaultCommandBuilder;
            var discription          = GlobalEntityDescriptionLookup.Instance.LookUpEntityByType(typeof(TResult));
            SqlSelectBuilder builder = commandBuilder.BuildSelect(source ?? discription.Source, discription.Fields);

            return(new QueryBuilder <TResult>(connection, builder));
        }