Example #1
0
        private static void SetCache(int maxDepth)
        {
            var key   = string.Concat(typeof(TSource).FullName, typeof(TDestination).FullName);
            var cache = ProjectionExpression <TSource> .ConfigurationCache;

            if (cache.ContainsKey(key))
            {
                cache[key].MaxDepth = maxDepth;
            }
            else
            {
                var config = new BaseProjectionConfig();
                config.MaxDepth = maxDepth;
                cache.Add(key, config);
            }
        }
Example #2
0
        private static void SetCache(params ExpressionModel[] expressionModels)
        {
            if (expressionModels == null || expressionModels.Length == 0)
            {
                return;
            }

            var key   = string.Concat(typeof(TSource).FullName, typeof(TDestination).FullName);
            var cache = ProjectionExpression <TSource> .ConfigurationCache;

            if (cache.ContainsKey(key))
            {
                cache[key].Expressions.AddRange(expressionModels);
            }
            else
            {
                var config = new BaseProjectionConfig();
                config.Expressions.AddRange(expressionModels);
                cache.Add(key, config);
            }
        }