Exemplo n.º 1
0
        protected Tuple <List <Expression>, ParameterExpression, ParameterExpression> GetMapExpressions(Type src, Type dest)
        {
            var cacheKey = MappingServiceProvider.CalculateCacheKey(src, dest);

            if (TypeMappers.ContainsKey(cacheKey))
            {
                return(TypeMappers[cacheKey].GetMapExpressions());
            }
            throw new MapNotImplementedException(string.Format("There is no mapping has bee found. Source Type: {0}, Destination Type: {1}", src.FullName, dest.FullName));
        }
Exemplo n.º 2
0
        public Expression GetMemberQueryableExpression(Type srcType, Type dstType)
        {
            var cacheKey = MappingServiceProvider.CalculateCacheKey(srcType, dstType);

            if (!TypeMappers.ContainsKey(cacheKey))
            {
                return(null);
            }

            var typeMapper = TypeMappers[cacheKey];

            if (typeMapper.QueryableGeneralExpression == null)
            {
                typeMapper.Compile(CompilationTypes.Source);
            }
            return(typeMapper.QueryableGeneralExpression);
        }
Exemplo n.º 3
0
        protected Tuple <List <Expression>, ParameterExpression, ParameterExpression> GetMapExpressions(Type src, Type dest)
        {
            var cacheKey = MappingServiceProvider.CalculateCacheKey(src, dest);

            if (TypeMappers.ContainsKey(cacheKey))
            {
                return(TypeMappers[cacheKey].GetMapExpressions());
            }

            dynamic srcInst  = Activator.CreateInstance(src);
            dynamic destInst = Activator.CreateInstance(dest);

            RegisterDynamic(srcInst, destInst);
            if (TypeMappers.ContainsKey(cacheKey))
            {
                return(TypeMappers[cacheKey].GetMapExpressions());
            }

            throw new MapNotImplementedException(
                      $"There is no mapping has been found. Source Type: {src.FullName}, Destination Type: {dest.FullName}");
        }