示例#1
0
        public void Configure(IApplicationBuilder app, IHostingEnvironment env,
                              ILoggerFactory loggerFactory, AngryBirdContext angryBirdContext)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler();
            }

            // Mappings between entities and dto:s
            AutoMapper.Mapper.Initialize(cfg =>
            {
                cfg.CreateMap <Player, PlayerDto>();
                cfg.CreateMap <PlayerForCreationDto, Player>().ReverseMap();
                cfg.CreateMap <PlayerForManipulationDto, Player>().ReverseMap();

                cfg.CreateMap <Map, MapDto>();
                cfg.CreateMap <MapForCreationDto, Map>().ReverseMap();
                cfg.CreateMap <MapForManipulationDto, Map>().ReverseMap();

                cfg.CreateMap <Round, RoundDto>();
                cfg.CreateMap <RoundForCreationDto, Round>().ReverseMap();
                cfg.CreateMap <RoundForManipulationDto, Round>().ReverseMap();
            });

            app.UseMvc();
        }
 public PlayerRepository(AngryBirdContext context)
 {
     _context = context;
 }