none
查询延时加载 RRS feed

  • 问题

  •  var hs = MyFramework.SNH.DaoService.GetService<Model.PowerHistory>().GetAll();

    // Generated by .NET Reflector from G:\Project\04.code\PowerManager\Dlls\MyFramework.SNH.dll
    namespace MyFramework.SNH
    {
        using MyFramework.Interface;
        using MyFramework.Spring;
        using System;
        
        public class DaoService
        {
            public static IRepository<T> GetService<T>()
            {
                string[] strArray = typeof(T).ToString().Split(new char[] { '.' });
                return Ioc.New<IRepository<T>>(strArray[strArray.Length - 1] + Setting.DaoSuffix);
            }
            
            public static IRepository<T> GetServiceByName<T>(string name)
            {
                return Ioc.New<IRepository<T>>(name);
            }
        }
    }
    / Generated by .NET Reflector from G:\Project\04.code\PowerManager\Dlls\MyFramework.Interface.dll
    namespace MyFramework.Interface
    {
        using System;
        using System.Collections;
        using System.Collections.Generic;
        using System.Linq;
        using System.Linq.Expressions;
        using System.Runtime.CompilerServices;
        using System.Runtime.InteropServices;
        
        public interface IRepository<T>
        {
            void Add(T entity);
            bool Any<TType>(Expression<Func<T, bool>> predicate);
            int Count();
            int Count(Expression<Func<T, bool>> where);
            void Delete(Expression<Func<T, bool>> where);
            void Delete(T entity);
            void Delete(object id);
            IList<T> Distinct<TOrder>(Expression<Func<T, bool>> where, Expression<Func<T, TOrder>> order, bool? desc);
            void ExecHqlCommand(string command);
            IList ExecHqlQuery(string query);
            void ExecSqlCommand(string command);
            IList ExecSqlQuery(string query);
            bool Exists(object id);
            bool Exists(Expression<Func<T, bool>> where);
            T Get(Expression<Func<T, bool>> where);
            T Get<TOrder>(Expression<Func<T, bool>> where, Expression<Func<T, TOrder>> order);
            IList<T> GetAll();
            IList<T> GetAll<TOrder>(Expression<Func<T, TOrder>> order, bool desc = false);
            IList<T> GetAllWithPage(int pageIndex, int pageSize, out int count);
            IList<T> GetAllWithPage<TOrder>(Expression<Func<T, TOrder>> order, int pageIndex, int pageSize, out int count, bool desc = false);
            IList<T> GetAscAll<TOrder>(Expression<Func<T, TOrder>> order);
            T GetById(object id);
            IList<T> GetDescAll<TOrder>(Expression<Func<T, TOrder>> order);
            T GetLast<TOrder>(Expression<Func<T, bool>> where, Expression<Func<T, TOrder>> order);
            IList<T> GetListByQuery(string query, bool useHql = false);
            IList<T> GetMany(Expression<Func<T, bool>> where);
            IList<T> GetMany(Expression<Func<T, bool>> where, [Dynamic(new bool[] { false, false, false, false, true })] IList<Expression<Func<T, object>>> orderList, IList<bool> orderDescList);
            IList<T> GetMany<TOrder>(Expression<Func<T, bool>> where, Expression<Func<T, TOrder>> order, bool desc = false);
            IQueryable<T> GetManyQueryable(Expression<Func<T, bool>> where);
            IList<T> GetManyWithPage(Expression<Func<T, bool>> where, int pageIndex, int pageSize, out int count);
            IList<T> GetManyWithPage(Expression<Func<T, bool>> where, [Dynamic(new bool[] { false, false, false, false, true })] IList<Expression<Func<T, object>>> orderList, IList<bool> orderDescList, int pageIndex, int pageSize, out int count);
            IList<T> GetManyWithPage<TOrder>(Expression<Func<T, bool>> where, Expression<Func<T, TOrder>> order, int pageIndex, int pageSize, out int count, bool desc = false);
            DateTime GetTime();
            IList<T> GetTopByOrder<TOrder>(Expression<Func<T, bool>> where, int count, Expression<Func<T, TOrder>> order, bool desc = false);
            IList<TType> GetTypeListByQuery<TType>(string query, bool useHql = false);
            Ttype Max<Ttype>(Expression<Func<T, bool>> where, Expression<Func<T, Ttype>> column);
            void Merge(T entity);
            Ttype Min<Ttype>(Expression<Func<T, bool>> where, Expression<Func<T, Ttype>> column);
            void Save(T entity);
            decimal Sum(Expression<Func<T, bool>> where, Expression<Func<T, decimal>> sum);
            double Sum(Expression<Func<T, bool>> where, Expression<Func<T, double>> sum);
            int Sum(Expression<Func<T, bool>> where, Expression<Func<T, int>> sum);
            long Sum(Expression<Func<T, bool>> where, Expression<Func<T, long>> sum);
            float Sum(Expression<Func<T, bool>> where, Expression<Func<T, float>> sum);
            decimal? Sum(Expression<Func<T, bool>> where, Expression<Func<T, decimal?>> sum);
            double? Sum(Expression<Func<T, bool>> where, Expression<Func<T, double?>> sum);
            int? Sum(Expression<Func<T, bool>> where, Expression<Func<T, int?>> sum);
            long? Sum(Expression<Func<T, bool>> where, Expression<Func<T, long?>> sum);
            float? Sum(Expression<Func<T, bool>> where, Expression<Func<T, float?>> sum);
            void Update(T entity);
        }
    }


    这个是把所有数据都查询出来了,能不能设置成延时加载?


    please verify my account


    • 已编辑 lctk 2016年11月2日 4:39
    2016年11月2日 4:12