public ComplexFunctionBuilder(Type targetType, IGenericCombiner combiner)
 {
     _targetType = targetType;
     _pPrev = Expression.Parameter(_targetType);
     _pNext = Expression.Parameter(_targetType);
     _combiner = combiner;
 }
Ejemplo n.º 2
0
        public object CreateFunction(Type targetType, IGenericCombiner combiner)
        {
            if(IsSimplyStruct(targetType))
                return BuildToolkit.CreateForwardCombiner(targetType);

            object result = null;

            result = BuildToolkit.TryCreateRecursiveNullableCombiner(targetType, combiner);
            if(result != null)
                return result;

            result = BuildToolkit.TryCreateCollectionCombiner(targetType);
            if(result != null)
                return result;

            var builder = new ComplexFunctionBuilder(targetType, combiner);
            result = builder.Compile();
            if(result != null)
                return result;

            return BuildToolkit.CreateForwardCombiner(targetType);
        }