/// <summary> /// 缓存 /// </summary> /// <typeparam name="TRtn">缓存的数据类型</typeparam> /// <param name="cache"></param> /// <param name="tableEntityType">表的实体类型(用于获取表名)</param> /// <param name="cacheType">缓存的类型</param> /// <param name="sql"></param> /// <param name="sqlParams">sql的参数</param> /// <param name="toDBGet">用于初始化缓存数据(例如:到数据库获取数据进行缓存的操作)</param> /// <param name="expiryPolicy">缓存过期策略</param> /// <returns></returns> public static TRtn CacheUseDict <TRtn>(this IEFQueryCache cache, Type tableEntityType, string cacheType, string sql, IDictionary <string, object> sqlParams, Func <TRtn> toDBGet, IQueryCacheExpiryPolicy expiryPolicy) { return(cache.CacheUseDict(EFHelper.Services.EFCoreExUtility.GetTableName(tableEntityType), cacheType, sql, sqlParams, toDBGet, expiryPolicy)); }
/// <summary> /// 缓存 /// </summary> /// <typeparam name="TEntity">表的实体类型(用于获取表名)</typeparam> /// <typeparam name="TRtn">缓存的数据类型</typeparam> /// <param name="cache"></param> /// <param name="cacheType">缓存的类型</param> /// <param name="sql"></param> /// <param name="sqlParams">sql的参数</param> /// <param name="toDBGet">用于初始化缓存数据(例如:到数据库获取数据进行缓存的操作)</param> /// <param name="expiryPolicy">缓存过期策略</param> /// <returns></returns> public static TRtn CacheUseDict <TEntity, TRtn>(this IEFQueryCache cache, string cacheType, string sql, IDictionary <string, object> sqlParams, Func <TRtn> toDBGet, IQueryCacheExpiryPolicy expiryPolicy) { return(cache.CacheUseDict(typeof(TEntity), cacheType, sql, sqlParams, toDBGet, expiryPolicy)); }