Exemplo n.º 1
0
        public static ViewModelCache GetViewModelCache(this IZetboxContext ctx, IPerfCounter perfCounter)
        {
            if (ctx == null)
            {
                throw new ArgumentNullException("ctx");
            }

            object result;

            if (!ctx.TransientState.TryGetValue(CacheKey, out result))
            {
                result = new ViewModelCache(perfCounter);
                ctx.TransientState[CacheKey] = result;
            }

            return((ViewModelCache)result);
        }
Exemplo n.º 2
0
        public static ViewModelCache GetViewModelCache(this IZetboxContext ctx, IPerfCounter perfCounter)
        {
            if (ctx == null) throw new ArgumentNullException("ctx");

            object result;
            if (!ctx.TransientState.TryGetValue(CacheKey, out result))
            {
                result = new ViewModelCache(perfCounter);
                ctx.TransientState[CacheKey] = result;
            }

            return (ViewModelCache)result;
        }