Skip to content

Commit 30f4952

Browse files
authored
Supporting AutoMapper v15. (#244)
1 parent 7481f95 commit 30f4952

File tree

7 files changed

+19
-14
lines changed

7 files changed

+19
-14
lines changed

AutoMapper.AspNetCore.OData.EF6/AutoMapper.AspNetCore.OData.EF6.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<PackageId>AutoMapper.AspNetCore.OData.EF6</PackageId>
77
<Description>Creates LINQ expressions from ODataQueryOptions and executes the query.</Description>
88
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
9-
<PackageReleaseNotes>Supporting AutoMapper v14 (EF Core only).</PackageReleaseNotes>
9+
<PackageReleaseNotes>Supporting AutoMapper v15 (EF Core only).</PackageReleaseNotes>
1010
<PackageTags>linq expressions odata efcore</PackageTags>
1111
<PackageIcon>icon.png</PackageIcon>
1212
<RepositoryUrl>https://github.com/AutoMapper/AutoMapper.Extensions.OData</RepositoryUrl>

AutoMapper.AspNetCore.OData.EFCore/AutoMapper.AspNetCore.OData.EFCore.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<PackageId>AutoMapper.AspNetCore.OData.EFCore</PackageId>
77
<Description>Creates LINQ expressions from ODataQueryOptions and executes the query.</Description>
88
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
9-
<PackageReleaseNotes>Supporting AutoMapper v14 (EF Core only).</PackageReleaseNotes>
9+
<PackageReleaseNotes>Supporting AutoMapper v15 (EF Core only).</PackageReleaseNotes>
1010
<PackageTags>linq expressions odata efcore</PackageTags>
1111
<PackageIcon>icon.png</PackageIcon>
1212
<RepositoryUrl>https://github.com/AutoMapper/AutoMapper.Extensions.OData</RepositoryUrl>
@@ -30,7 +30,7 @@
3030
</ItemGroup>
3131

3232
<ItemGroup>
33-
<PackageReference Include="AutoMapper.Extensions.ExpressionMapping" Version="[8.0.0,9.0.0)" />
33+
<PackageReference Include="AutoMapper.Extensions.ExpressionMapping" Version="[9.0.0,10.0.0)" />
3434
<PackageReference Include="LogicBuilder.Expressions.Utils" Version="7.0.0" />
3535
<PackageReference Include="Microsoft.AspNetCore.OData" Version="9.1.1" />
3636
<PackageReference Include="MinVer" Version="6.0.0">

AutoMapper.OData.EFCore.Tests/ExpansionTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using Microsoft.AspNetCore.OData.Query;
88
using Microsoft.EntityFrameworkCore;
99
using Microsoft.Extensions.DependencyInjection;
10+
using Microsoft.Extensions.Logging.Abstractions;
1011
using System;
1112
using System.Collections.Generic;
1213
using System.Linq;
@@ -217,7 +218,7 @@ public ExpansionTestsFixture()
217218
),
218219
ServiceLifetime.Transient
219220
)
220-
.AddSingleton<IConfigurationProvider>(new MapperConfiguration(cfg => cfg.AddMaps(typeof(GetTests).Assembly)))
221+
.AddSingleton<IConfigurationProvider>(new MapperConfiguration(cfg => cfg.AddMaps(typeof(GetTests).Assembly), new NullLoggerFactory()))
221222
.AddTransient<IMapper>(sp => new Mapper(sp.GetRequiredService<IConfigurationProvider>(), sp.GetService))
222223
.AddTransient<IApplicationBuilder>(sp => new ApplicationBuilder(sp))
223224
.AddRouting()

AutoMapper.OData.EFCore.Tests/GetQuerySelectTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using Microsoft.AspNetCore.OData.Query;
88
using Microsoft.EntityFrameworkCore;
99
using Microsoft.Extensions.DependencyInjection;
10+
using Microsoft.Extensions.Logging.Abstractions;
1011
using System;
1112
using System.Collections.Generic;
1213
using System.Linq;
@@ -213,7 +214,7 @@ public GetQuerySelectTestsFixture()
213214
),
214215
ServiceLifetime.Transient
215216
)
216-
.AddSingleton<IConfigurationProvider>(new MapperConfiguration(cfg => cfg.AddMaps(typeof(GetTests).Assembly)))
217+
.AddSingleton<IConfigurationProvider>(new MapperConfiguration(cfg => cfg.AddMaps(typeof(GetTests).Assembly), new NullLoggerFactory()))
217218
.AddTransient<IMapper>(sp => new Mapper(sp.GetRequiredService<IConfigurationProvider>(), sp.GetService))
218219
.AddTransient<IApplicationBuilder>(sp => new ApplicationBuilder(sp))
219220
.AddRouting()

AutoMapper.OData.EFCore.Tests/GetQueryTests.cs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Threading;
5-
using System.Threading.Tasks;
6-
using AutoMapper.AspNet.OData;
1+
using AutoMapper.AspNet.OData;
72
using AutoMapper.OData.EFCore.Tests.Data;
83
using AutoMapper.OData.EFCore.Tests.Model;
94
using DAL.EFCore;
@@ -14,6 +9,12 @@
149
using Microsoft.AspNetCore.OData.Query;
1510
using Microsoft.EntityFrameworkCore;
1611
using Microsoft.Extensions.DependencyInjection;
12+
using Microsoft.Extensions.Logging.Abstractions;
13+
using System;
14+
using System.Collections.Generic;
15+
using System.Linq;
16+
using System.Threading;
17+
using System.Threading.Tasks;
1718
using Xunit;
1819

1920
namespace AutoMapper.OData.EFCore.Tests
@@ -1921,7 +1922,7 @@ public GetQueryTestsFixture()
19211922
),
19221923
ServiceLifetime.Transient
19231924
)
1924-
.AddSingleton<IConfigurationProvider>(new MapperConfiguration(cfg => cfg.AddMaps(typeof(GetTests).Assembly)))
1925+
.AddSingleton<IConfigurationProvider>(new MapperConfiguration(cfg => cfg.AddMaps(typeof(GetTests).Assembly), new NullLoggerFactory()))
19251926
.AddTransient<IMapper>(sp => new Mapper(sp.GetRequiredService<IConfigurationProvider>(), sp.GetService))
19261927
.AddTransient<IApplicationBuilder>(sp => new ApplicationBuilder(sp))
19271928
.AddRouting()

AutoMapper.OData.EFCore.Tests/GetTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
using Microsoft.AspNetCore.OData.Query.Expressions;
1313
using Microsoft.EntityFrameworkCore;
1414
using Microsoft.Extensions.DependencyInjection;
15+
using Microsoft.Extensions.Logging.Abstractions;
1516
using Microsoft.OData.Edm;
1617
using Microsoft.OData.ModelBuilder;
1718
using Microsoft.OData.UriParser;
@@ -776,7 +777,7 @@ public GetTestsFixture()
776777
),
777778
ServiceLifetime.Transient
778779
)
779-
.AddSingleton<IConfigurationProvider>(new MapperConfiguration(cfg => cfg.AddMaps(typeof(GetTests).Assembly)))
780+
.AddSingleton<IConfigurationProvider>(new MapperConfiguration(cfg => cfg.AddMaps(typeof(GetTests).Assembly), new NullLoggerFactory()))
780781
.AddTransient<IMapper>(sp => new Mapper(sp.GetRequiredService<IConfigurationProvider>(), sp.GetService))
781782
.AddTransient<IApplicationBuilder>(sp => new ApplicationBuilder(sp))
782783
.AddRouting()

WebAPI.OData.EFCore/Startup.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using Microsoft.EntityFrameworkCore;
99
using Microsoft.Extensions.Configuration;
1010
using Microsoft.Extensions.DependencyInjection;
11+
using Microsoft.Extensions.Logging.Abstractions;
1112
using Microsoft.OData.Edm;
1213
using Microsoft.OData.ModelBuilder;
1314
using WebAPI.OData.EFCore.Binders;
@@ -38,7 +39,7 @@ public void ConfigureServices(IServiceCollection services)
3839
{
3940
cfg.AddMaps(typeof(Startup).Assembly);
4041
cfg.AllowNullCollections = true;
41-
})
42+
}, new NullLoggerFactory())
4243
)
4344
.AddScoped<IMapper>(sp => new Mapper(sp.GetRequiredService<AutoMapper.IConfigurationProvider>(), sp.GetService));
4445
}

0 commit comments

Comments
 (0)