예제 #1
0
        /// <summary>
        /// 启用缓存,并估计缓存的数量。
        /// </summary>
        /// <param name="meta"></param>
        /// <param name="estimatedDataCount">
        /// 预估的数据行数。
        /// 系统会根据此数量来选择使用的缓存策略。例如:超过 1000 条的组合子对象使用组合缓存。
        /// </param>
        /// <returns></returns>
        public static EntityMeta EnableClientCache(this EntityMeta meta, int estimatedDataCount)
        {
            var type = ClientCacheScopeType.Table;

            //超过 1000 条的组合子对象使用组合缓存。
            if (estimatedDataCount >= 1000 && meta.EntityCategory == EntityCategory.Child)
            {
                type = ClientCacheScopeType.ScopedByRoot;
            }

            meta.EnableClientCache(type);
            return(meta);
        }