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)))); } }
public static bool ShouldUse() { return(ConstructorMappingCompiler <TFrom, TTo> .GetConstructor() != null); }
protected override Expression CreateCollectionInstantiationExpression(Expression itemMappingExpression) { return(Expression.New(ConstructorMappingCompiler <TFrom, TTo> .GetConstructor(), itemMappingExpression)); }