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