Skip to content

Commit edf1f88

Browse files
jbogardSteveSandersonMS
authored andcommitted
Updating to AutoMapper 5.0
1 parent f4afb25 commit edf1f88

File tree

4 files changed

+24
-18
lines changed

4 files changed

+24
-18
lines changed

samples/angular/MusicStore/Startup.cs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,17 @@ public void ConfigureServices(IServiceCollection services)
4545
options.AddPolicy("app-ManageStore", new AuthorizationPolicyBuilder().RequireClaim("app-ManageStore", "Allowed").Build());
4646
});
4747

48-
Mapper.CreateMap<AlbumChangeDto, Album>();
49-
Mapper.CreateMap<Album, AlbumChangeDto>();
50-
Mapper.CreateMap<Album, AlbumResultDto>();
51-
Mapper.CreateMap<AlbumResultDto, Album>();
52-
Mapper.CreateMap<Artist, ArtistResultDto>();
53-
Mapper.CreateMap<ArtistResultDto, Artist>();
54-
Mapper.CreateMap<Genre, GenreResultDto>();
55-
Mapper.CreateMap<GenreResultDto, Genre>();
48+
Mapper.Initialize(cfg =>
49+
{
50+
cfg.CreateMap<AlbumChangeDto, Album>();
51+
cfg.CreateMap<Album, AlbumChangeDto>();
52+
cfg.CreateMap<Album, AlbumResultDto>();
53+
cfg.CreateMap<AlbumResultDto, Album>();
54+
cfg.CreateMap<Artist, ArtistResultDto>();
55+
cfg.CreateMap<ArtistResultDto, Artist>();
56+
cfg.CreateMap<Genre, GenreResultDto>();
57+
cfg.CreateMap<GenreResultDto, Genre>();
58+
});
5659
}
5760

5861
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.

samples/angular/MusicStore/project.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"Microsoft.Extensions.Logging.Debug": "1.0.0",
3030
"Microsoft.EntityFrameworkCore.SQLite": "1.0.0",
3131
"Microsoft.AspNetCore.AngularServices": "1.0.0-*",
32-
"AutoMapper": "4.1.1"
32+
"AutoMapper": "5.0.2"
3333
},
3434
"frameworks": {
3535
"netcoreapp1.0": {

samples/react/MusicStore/Startup.cs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,17 @@ public void ConfigureServices(IServiceCollection services)
4747
options.AddPolicy("app-ManageStore", new AuthorizationPolicyBuilder().RequireClaim("app-ManageStore", "Allowed").Build());
4848
});
4949

50-
Mapper.CreateMap<AlbumChangeDto, Album>();
51-
Mapper.CreateMap<Album, AlbumChangeDto>();
52-
Mapper.CreateMap<Album, AlbumResultDto>();
53-
Mapper.CreateMap<AlbumResultDto, Album>();
54-
Mapper.CreateMap<Artist, ArtistResultDto>();
55-
Mapper.CreateMap<ArtistResultDto, Artist>();
56-
Mapper.CreateMap<Genre, GenreResultDto>();
57-
Mapper.CreateMap<GenreResultDto, Genre>();
50+
Mapper.Initialize(cfg =>
51+
{
52+
cfg.CreateMap<AlbumChangeDto, Album>();
53+
cfg.CreateMap<Album, AlbumChangeDto>();
54+
cfg.CreateMap<Album, AlbumResultDto>();
55+
cfg.CreateMap<AlbumResultDto, Album>();
56+
cfg.CreateMap<Artist, ArtistResultDto>();
57+
cfg.CreateMap<ArtistResultDto, Artist>();
58+
cfg.CreateMap<Genre, GenreResultDto>();
59+
cfg.CreateMap<GenreResultDto, Genre>();
60+
});
5861
}
5962

6063
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.

samples/react/MusicStore/project.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"Microsoft.Extensions.Logging.Debug": "1.0.0",
3030
"Microsoft.EntityFrameworkCore.SQLite": "1.0.0",
3131
"Microsoft.AspNetCore.ReactServices": "1.0.0-*",
32-
"AutoMapper": "4.1.1"
32+
"AutoMapper": "5.0.2"
3333
},
3434
"frameworks": {
3535
"netcoreapp1.0": {

0 commit comments

Comments
 (0)