Пример #1
0
        public void Initialize()
        {
            Mapper.Initialize(cfg =>
            {
                cfg.CreateMap<Model1, Dto1>();
                cfg.CreateMap<Model2, Dto2>();
                cfg.CreateMap<Model3, Dto3>();
                cfg.CreateMap<Model4, Dto4>();
                cfg.CreateMap<Model5, Dto5>();
                cfg.CreateMap<Model6, Dto6>();
                cfg.CreateMap<Model7, Dto7>();
                cfg.CreateMap<Model8, Dto8>();
                cfg.CreateMap<Model9, Dto9>();
                cfg.CreateMap<Model10, Dto10>();
                cfg.CreateMap<ModelObject, ModelDto>();
            });

            Mapper.AssertConfigurationIsValid();

            _source = new ModelObject
            {
                BaseDate = new DateTime(2007, 4, 5),
                Sub = new ModelSubObject
                {
                    ProperName = "Some name",
                    SubSub = new ModelSubSubObject {IAmACoolProperty = "Cool daddy-o"}
                },
                Sub2 = new ModelSubObject {ProperName = "Sub 2 name"},
                SubWithExtraName = new ModelSubObject {ProperName = "Some other name"}
            };
        }
Пример #2
0
 public void Initialize()
 {
     _source = new ModelObject
     {
         BaseDate = new DateTime(2007, 4, 5),
         Sub = new ModelSubObject
         {
             ProperName = "Some name",
             SubSub = new ModelSubSubObject {IAmACoolProperty = "Cool daddy-o"}
         },
         Sub2 = new ModelSubObject {ProperName = "Sub 2 name"},
         SubWithExtraName = new ModelSubObject {ProperName = "Some other name"}
     };
 }
Пример #3
0
 public void Initialize()
 {
     _source = new ModelObject
     {
         BaseDate = new DateTime(2007, 4, 5),
         Sub = new ModelSubObject
         {
             ProperName = "Some name",
             SubSub = new ModelSubSubObject
             {
                 IAmACoolProperty = "Cool daddy-o"
             }
         },
         Sub2 = new ModelSubObject
         {
             ProperName = "Sub 2 name"
         },
         SubWithExtraName = new ModelSubObject
         {
             ProperName = "Some other name"
         },
     };
     _context = new ResolutionContext(_source, null, new TypePair(typeof(ModelObject), typeof(ModelDto)), null, new Mapper(new MapperConfiguration(_ => { })));
 }