Exemplo n.º 1
0
        private object MapCore(object source, Type sourceType, Type destinationType, MappingOperationOptions options)
        {
            var typeMap = ConfigurationProvider.ResolveTypeMap(source, null, sourceType, destinationType);

            var context = new ResolutionContext(typeMap, source, sourceType, destinationType, options, this);

            return(((IMappingEngineRunner)this).Map(context));
        }
Exemplo n.º 2
0
        public object Map(object source, Type sourceType, Type destinationType, Action <IMappingOperationOptions> opts)
        {
            var options = new MappingOperationOptions();

            opts(options);

            return(MapCore(source, sourceType, destinationType, options));
        }
Exemplo n.º 3
0
 public ResolutionContext(TypeMap typeMap, object source, object destination, Type sourceType,
                          Type destinationType, MappingOperationOptions options, IMappingEngine engine)
     : this(Empty, source, destination, sourceType, destinationType, typeMap)
 {
     InstanceCache = new Dictionary <ResolutionContext, object>();
     Options       = options;
     Engine        = engine;
 }
Exemplo n.º 4
0
        public TDestination Map <TSource, TDestination>(TSource source, TDestination destination,
                                                        Action <IMappingOperationOptions <TSource, TDestination> > opts)
        {
            var modelType       = typeof(TSource);
            var destinationType = typeof(TDestination);

            var options = new MappingOperationOptions <TSource, TDestination>();

            opts(options);

            return((TDestination)MapCore(source, destination, modelType, destinationType, options));
        }
Exemplo n.º 5
0
 public ResolutionContext(TypeMap typeMap, object source, Type sourceType, Type destinationType,
                          MappingOperationOptions options, IMappingEngine engine)
     : this(typeMap, source, null, sourceType, destinationType, options, engine)
 {
 }