public SetterSpec(
     TypeMappingSpec <TTgt, TSrc> spec,
     PropertyInfo targetProperty
     )
 {
     _spec           = spec;
     _targetProperty = targetProperty;
 }
Ejemplo n.º 2
0
 public ExpandIntoNestedTargetSpec(
     TypeMappingSpec <TTarget, TSource> spec,
     Expression <Func <TTarget, TTargetProperty> > targetPropertyExpression)
     : this(spec, targetPropertyExpression, FluentMapper.ThatMaps <TNestedMappingTarget>().From <TSource>(), null)
 {
     if (!typeof(TTargetProperty).IsAssignableFrom(typeof(TNestedMappingTarget)))
     {
         throw new ArgumentException(string.Format("Must provide a mapping function from {0} to {1}.", typeof(TTargetProperty).Name, typeof(TNestedMappingTarget).Name));
     }
 }
Ejemplo n.º 3
0
        private ExpandIntoNestedTargetSpec(
            TypeMappingSpec <TTarget, TSource> spec,
            Expression <Func <TTarget, TTargetProperty> > targetPropertyExpression,
            TypeMappingSpec <TNestedMappingTarget, TSource> nestedSpec,
            Func <TNestedMappingTarget, TTargetProperty> targetMapFunc
            )
        {
            Spec = spec;
            TargetPropertyExpression = targetPropertyExpression;
            NestedSpec = nestedSpec;

            if (null == targetMapFunc)
            {
                var parm = Expression.Parameter(typeof(TNestedMappingTarget));
                targetMapFunc = Expression.Lambda <Func <TNestedMappingTarget, TTargetProperty> >(parm, parm).Compile();
            }

            TargetMapFunction = targetMapFunc;
        }
 public ContextualTypeMappingSpec(TypeMappingSpec <TTarget, TSource> innerSpec, IEnumerable <Expression> contextualMappings, Expression constructor)
 {
     InnerSpec          = innerSpec;
     ContextualMappings = contextualMappings ?? new Expression[0];
     Constructor        = constructor;
 }
 public ContextualTypeMappingSpec(TypeMappingSpec <TTarget, TSource> innerSpec) : this(innerSpec, null, null)
 {
 }
 public static TypeMappingSpec <TTarget, TSource> WithTargetAsBuilder <TTarget, TSource>(this TypeMappingSpec <TTarget, TSource> spec)
     where TTarget : class
     where TSource : class
 {
     MethodInfo[] methods;
     if (typeof(TTarget).IsInterface)
     {
         methods = new[] { typeof(TTarget) }
     }
Ejemplo n.º 7
0
 public SetterSpec(TypeMappingSpec <TTarget, TSource> spec, Expression <Func <TTarget, TProperty> > tgtPropExpression)
 {
     Spec = spec;
     TgtPropExpression = tgtPropExpression;
 }
Ejemplo n.º 8
0
 public NullSourceBehavior(TypeMappingSpec <TTgt, TSrc> spec)
 {
     _spec = spec;
 }
Ejemplo n.º 9
0
 protected abstract TypeMappingSpec <TTarget, TSource> Configure(TypeMappingSpec <TTarget, TSource> mappingSpec);
Ejemplo n.º 10
0
 public NullSourceBehavior(TypeMappingSpec <TTarget, TSource> spec)
 {
     Spec = spec;
 }