Esempio n. 1
0
 //create a new target and map source on it 
 public static TTarget Map<TSource, TTarget>(TSource source)
 {
     _objects = new List<ObjectContainer>();
     var target = (TTarget)Creator.Create(typeof(TTarget));
     var obj = MapperFactory.GetMapper<TSource, TTarget>().Map(source, target);
     _objects.Add(new ObjectContainer()
                      {
                          original = source,
                          converted = obj
                      });
     return obj;
 }
Esempio n. 2
0
 //map source to an existing target
 public static TTarget Map<TSource, TTarget>(TSource source, TTarget target)
 {
     target = MapperFactory.GetMapper<TSource, TTarget>().Map(source, target);
     return target;
 }