Esempio n. 1
0
        protected override Expression CreateEmptyCollectionExpression()
        {
            var defaultConstructor = ConstructorMappingCompiler <TFrom, TTo> .GetDefaultConstructor();

            if (defaultConstructor != null)
            {
                return(Expression.New(defaultConstructor));
            }
            else
            {
                var constructor = ConstructorMappingCompiler <TFrom, TTo> .GetConstructor();

                return(Expression.New(constructor, Expression.Constant(Array.CreateInstance(EnumerableReflection <TTo> .ItemType, 0))));
            }
        }
Esempio n. 2
0
 public static bool ShouldUse()
 {
     return(ConstructorMappingCompiler <TFrom, TTo> .GetConstructor() != null);
 }
Esempio n. 3
0
 protected override Expression CreateCollectionInstantiationExpression(Expression itemMappingExpression)
 {
     return(Expression.New(ConstructorMappingCompiler <TFrom, TTo> .GetConstructor(), itemMappingExpression));
 }