diff --git a/AutoMapper.AspNet.OData.EF6/AutoMapper.AspNet.OData.EF6.csproj b/AutoMapper.AspNet.OData.EF6/AutoMapper.AspNet.OData.EF6.csproj
index 1db9d24..4bae476 100644
--- a/AutoMapper.AspNet.OData.EF6/AutoMapper.AspNet.OData.EF6.csproj
+++ b/AutoMapper.AspNet.OData.EF6/AutoMapper.AspNet.OData.EF6.csproj
@@ -15,6 +15,12 @@
..\AutoMapper.snk
true
v
+ true
+ true
+ snupkg
+ true
+ true
+ true
@@ -52,12 +58,13 @@
-
+
-
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
+
diff --git a/AutoMapper.AspNetCore.OData.EF6/AutoMapper.AspNetCore.OData.EF6.csproj b/AutoMapper.AspNetCore.OData.EF6/AutoMapper.AspNetCore.OData.EF6.csproj
index 607a6d2..f3059f3 100644
--- a/AutoMapper.AspNetCore.OData.EF6/AutoMapper.AspNetCore.OData.EF6.csproj
+++ b/AutoMapper.AspNetCore.OData.EF6/AutoMapper.AspNetCore.OData.EF6.csproj
@@ -6,7 +6,7 @@
AutoMapper.AspNetCore.OData.EF6
Creates LINQ expressions from ODataQueryOptions and executes the query.
false
- Supporting Microsoft.AspNetCore.OData v8.0.0-rc.
+ Supporting Microsoft.AspNetCore.OData v8.0.1.
linq expressions odata efcore
https://s3.amazonaws.com/automapper/icon.png
https://github.com/AutoMapper/AutoMapper.Extensions.OData
@@ -15,6 +15,12 @@
..\AutoMapper.snk
true
v
+ true
+ true
+ snupkg
+ true
+ true
+ true
@@ -60,12 +66,13 @@
-
-
-
+
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
+
diff --git a/AutoMapper.AspNetCore.OData.EFCore/AutoMapper.AspNetCore.OData.EFCore.csproj b/AutoMapper.AspNetCore.OData.EFCore/AutoMapper.AspNetCore.OData.EFCore.csproj
index d1ec41d..2646f5f 100644
--- a/AutoMapper.AspNetCore.OData.EFCore/AutoMapper.AspNetCore.OData.EFCore.csproj
+++ b/AutoMapper.AspNetCore.OData.EFCore/AutoMapper.AspNetCore.OData.EFCore.csproj
@@ -6,7 +6,7 @@
AutoMapper.AspNetCore.OData.EFCore
Creates LINQ expressions from ODataQueryOptions and executes the query.
false
- Supporting Microsoft.AspNetCore.OData v8.0.0-rc.
+ Supporting Microsoft.AspNetCore.OData v8.0.1.
linq expressions odata efcore
https://s3.amazonaws.com/automapper/icon.png
https://github.com/AutoMapper/AutoMapper.Extensions.OData
@@ -15,6 +15,12 @@
..\AutoMapper.snk
true
v
+ true
+ true
+ snupkg
+ true
+ true
+ true
@@ -27,13 +33,14 @@
-
-
+
+
-
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
+
diff --git a/AutoMapper.OData.EF6.Tests/AutoMapper.OData.EF6.Tests.csproj b/AutoMapper.OData.EF6.Tests/AutoMapper.OData.EF6.Tests.csproj
index 8286fb4..7e230b5 100644
--- a/AutoMapper.OData.EF6.Tests/AutoMapper.OData.EF6.Tests.csproj
+++ b/AutoMapper.OData.EF6.Tests/AutoMapper.OData.EF6.Tests.csproj
@@ -7,10 +7,16 @@
-
+
-
-
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
diff --git a/AutoMapper.OData.EF6.Tests/GetQuerySelectTests.cs b/AutoMapper.OData.EF6.Tests/GetQuerySelectTests.cs
index 152aef5..78eded5 100644
--- a/AutoMapper.OData.EF6.Tests/GetQuerySelectTests.cs
+++ b/AutoMapper.OData.EF6.Tests/GetQuerySelectTests.cs
@@ -5,7 +5,6 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.OData;
using Microsoft.AspNetCore.OData.Query;
-using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
@@ -29,12 +28,18 @@ public GetQuerySelectTests()
private void Initialize()
{
IServiceCollection services = new ServiceCollection();
- services.AddOData();
+ IMvcCoreBuilder builder = new TestMvcCoreBuilder
+ {
+ Services = services
+ };
+
+ builder.AddOData();
services.AddTransient(_ => new TestDbContext())
.AddSingleton(new MapperConfiguration(cfg => cfg.AddMaps(typeof(GetTests).Assembly)))
.AddTransient(sp => new Mapper(sp.GetRequiredService(), sp.GetService))
.AddTransient(sp => new ApplicationBuilder(sp))
- .AddTransient(sp => new RouteBuilder(sp.GetRequiredService()));
+ .AddRouting()
+ .AddLogging();
serviceProvider = services.BuildServiceProvider();
}
@@ -182,8 +187,7 @@ private ODataQueryOptions GetODataQueryOptions(string query) whe
_oDataQueryOptions = ODataHelpers.GetODataQueryOptions
(
query,
- serviceProvider,
- serviceProvider.GetRequiredService()
+ serviceProvider
);
}
diff --git a/AutoMapper.OData.EF6.Tests/GetQueryTests.cs b/AutoMapper.OData.EF6.Tests/GetQueryTests.cs
index 1ecdc9b..f3ccd73 100644
--- a/AutoMapper.OData.EF6.Tests/GetQueryTests.cs
+++ b/AutoMapper.OData.EF6.Tests/GetQueryTests.cs
@@ -3,10 +3,10 @@
using AutoMapper.OData.EF6.Tests.Model;
using DAL.EF6;
using Domain.OData;
+using Microsoft.AspNetCore.Builder;
+using Microsoft.AspNetCore.OData;
using Microsoft.AspNetCore.OData.Extensions;
using Microsoft.AspNetCore.OData.Query;
-using Microsoft.AspNetCore.Builder;
-using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
@@ -14,7 +14,6 @@
using System.Threading;
using System.Threading.Tasks;
using Xunit;
-using Microsoft.AspNetCore.OData;
namespace AutoMapper.OData.EF6.Tests
{
@@ -32,12 +31,18 @@ public GetQueryTests()
private void Initialize()
{
IServiceCollection services = new ServiceCollection();
- services.AddOData();
+ IMvcCoreBuilder builder = new TestMvcCoreBuilder
+ {
+ Services = services
+ };
+
+ builder.AddOData();
services.AddTransient(_ => new TestDbContext())
.AddSingleton(new MapperConfiguration(cfg => cfg.AddMaps(typeof(GetTests).Assembly)))
.AddTransient(sp => new Mapper(sp.GetRequiredService(), sp.GetService))
.AddTransient(sp => new ApplicationBuilder(sp))
- .AddTransient(sp => new RouteBuilder(sp.GetRequiredService()));
+ .AddRouting()
+ .AddLogging();
serviceProvider = services.BuildServiceProvider();
}
@@ -305,8 +310,7 @@ public async void BuildingExpandBuilderTenantExpandCityFilterOnNestedNestedPrope
ODataQueryOptions options = ODataHelpers.GetODataQueryOptions
(
query,
- serviceProvider,
- serviceProvider.GetRequiredService()
+ serviceProvider
);
Test(Get(query, options));
Test(await GetAsync(query, options));
@@ -366,8 +370,7 @@ public async void BuildingExpandBuilderTenantExpandCityOrderByBuilderNameSkip3Ta
ODataQueryOptions options = ODataHelpers.GetODataQueryOptions
(
query,
- serviceProvider,
- serviceProvider.GetRequiredService()
+ serviceProvider
);
Test(Get(query, options));
Test(await GetAsync(query, options));
@@ -388,8 +391,7 @@ public async void BuildingExpandBuilderTenantExpandCityOrderByBuilderNameSkip3Ta
ODataQueryOptions options = ODataHelpers.GetODataQueryOptions
(
query,
- serviceProvider,
- serviceProvider.GetRequiredService()
+ serviceProvider
);
Test(Get(query, options));
@@ -484,8 +486,7 @@ public async void BuildingWithTopAndSmallerPageSizeNextLink()
ODataQueryOptions options = ODataHelpers.GetODataQueryOptions
(
query,
- serviceProvider,
- serviceProvider.GetRequiredService()
+ serviceProvider
);
Test(Get(query, options, new QuerySettings { ODataSettings = new ODataSettings { HandleNullPropagation = HandleNullPropagationOption.False, PageSize = pageSize } }));
@@ -511,8 +512,7 @@ public async void BuildingWithTopAndLargerPageSizeNextLink()
ODataQueryOptions options = ODataHelpers.GetODataQueryOptions
(
query,
- serviceProvider,
- serviceProvider.GetRequiredService()
+ serviceProvider
);
Test(Get(query, options, new QuerySettings { ODataSettings = new ODataSettings { HandleNullPropagation = HandleNullPropagationOption.False, PageSize = pageSize } }));
@@ -917,8 +917,7 @@ private ODataQueryOptions GetODataQueryOptions(string query) whe
_oDataQueryOptions = ODataHelpers.GetODataQueryOptions
(
query,
- serviceProvider,
- serviceProvider.GetRequiredService()
+ serviceProvider
);
}
diff --git a/AutoMapper.OData.EF6.Tests/GetTests.cs b/AutoMapper.OData.EF6.Tests/GetTests.cs
index f358a04..c200ba7 100644
--- a/AutoMapper.OData.EF6.Tests/GetTests.cs
+++ b/AutoMapper.OData.EF6.Tests/GetTests.cs
@@ -4,10 +4,10 @@
using Domain.OData;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc.ApplicationParts;
using Microsoft.AspNetCore.OData;
using Microsoft.AspNetCore.OData.Extensions;
using Microsoft.AspNetCore.OData.Query;
-using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.OData.Edm;
using Microsoft.OData.ModelBuilder;
@@ -35,12 +35,18 @@ public GetTests()
private void Initialize()
{
IServiceCollection services = new ServiceCollection();
- services.AddOData();
+ IMvcCoreBuilder builder = new TestMvcCoreBuilder
+ {
+ Services = services
+ };
+
+ builder.AddOData();
services.AddTransient(_ => new TestDbContext())
.AddSingleton(new MapperConfiguration(cfg => cfg.AddMaps(typeof(GetTests).Assembly)))
.AddTransient(sp => new Mapper(sp.GetRequiredService(), sp.GetService))
.AddTransient(sp => new ApplicationBuilder(sp))
- .AddTransient(sp => new RouteBuilder(sp.GetRequiredService()));
+ .AddRouting()
+ .AddLogging();
serviceProvider = services.BuildServiceProvider();
}
@@ -196,8 +202,7 @@ public async void BuildingExpandBuilderTenantExpandCityFilterOnNestedNestedPrope
ODataQueryOptions options = ODataHelpers.GetODataQueryOptions
(
query,
- serviceProvider,
- serviceProvider.GetRequiredService()
+ serviceProvider
);
Test(Get(query, options));
Test(await GetAsync(query, options));
@@ -257,8 +262,7 @@ public async void BuildingExpandBuilderTenantExpandCityOrderByBuilderNameSkip3Ta
ODataQueryOptions options = ODataHelpers.GetODataQueryOptions
(
query,
- serviceProvider,
- serviceProvider.GetRequiredService()
+ serviceProvider
);
Test(Get(query, options));
Test(await GetAsync(query, options));
@@ -279,8 +283,7 @@ public async void BuildingExpandBuilderTenantExpandCityOrderByBuilderNameSkip3Ta
ODataQueryOptions options = ODataHelpers.GetODataQueryOptions
(
query,
- serviceProvider,
- serviceProvider.GetRequiredService()
+ serviceProvider
);
Test(Get(query, options));
@@ -375,8 +378,7 @@ public async void BuildingWithTopAndSmallerPageSizeNextLink()
ODataQueryOptions options = ODataHelpers.GetODataQueryOptions
(
query,
- serviceProvider,
- serviceProvider.GetRequiredService()
+ serviceProvider
);
Test(Get(query, options, new QuerySettings { ODataSettings = new ODataSettings { HandleNullPropagation = HandleNullPropagationOption.False, PageSize = pageSize } }));
@@ -402,8 +404,7 @@ public async void BuildingWithTopAndLargerPageSizeNextLink()
ODataQueryOptions options = ODataHelpers.GetODataQueryOptions
(
query,
- serviceProvider,
- serviceProvider.GetRequiredService()
+ serviceProvider
);
Test(Get(query, options, new QuerySettings { ODataSettings = new ODataSettings { HandleNullPropagation = HandleNullPropagationOption.False, PageSize = pageSize } }));
@@ -517,8 +518,7 @@ private ODataQueryOptions GetODataQueryOptions(string query) whe
_oDataQueryOptions = ODataHelpers.GetODataQueryOptions
(
query,
- serviceProvider,
- serviceProvider.GetRequiredService()
+ serviceProvider
);
}
@@ -528,7 +528,7 @@ private ODataQueryOptions GetODataQueryOptions(string query) whe
public static class ODataHelpers
{
- public static ODataQueryOptions GetODataQueryOptions(string queryString, IServiceProvider serviceProvider, IRouteBuilder routeBuilder) where T : class
+ public static ODataQueryOptions GetODataQueryOptions(string queryString, IServiceProvider serviceProvider) where T : class
{
ODataConventionModelBuilder builder = new ODataConventionModelBuilder();
@@ -564,4 +564,10 @@ static HttpRequest BuildRequest(HttpRequest request, Uri uri)
static readonly string BASEADDRESS = "http://localhost:16324";
}
+
+ internal class TestMvcCoreBuilder : IMvcCoreBuilder
+ {
+ public ApplicationPartManager PartManager { get; set; }
+ public IServiceCollection Services { get; set; }
+ }
}
diff --git a/AutoMapper.OData.EFCore.Tests/AutoMapper.OData.EFCore.Tests.csproj b/AutoMapper.OData.EFCore.Tests/AutoMapper.OData.EFCore.Tests.csproj
index fe5ee81..3c4e143 100644
--- a/AutoMapper.OData.EFCore.Tests/AutoMapper.OData.EFCore.Tests.csproj
+++ b/AutoMapper.OData.EFCore.Tests/AutoMapper.OData.EFCore.Tests.csproj
@@ -8,9 +8,12 @@
-
+
-
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
diff --git a/AutoMapper.OData.EFCore.Tests/GetQuerySelectTests.cs b/AutoMapper.OData.EFCore.Tests/GetQuerySelectTests.cs
index 06314dc..c408b50 100644
--- a/AutoMapper.OData.EFCore.Tests/GetQuerySelectTests.cs
+++ b/AutoMapper.OData.EFCore.Tests/GetQuerySelectTests.cs
@@ -5,7 +5,6 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.OData;
using Microsoft.AspNetCore.OData.Query;
-using Microsoft.AspNetCore.Routing;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using System;
@@ -30,7 +29,12 @@ public GetQuerySelectTests()
private void Initialize()
{
IServiceCollection services = new ServiceCollection();
- services.AddOData();
+ IMvcCoreBuilder builder = new TestMvcCoreBuilder
+ {
+ Services = services
+ };
+
+ builder.AddOData();
services.AddDbContext
(
options =>
@@ -43,7 +47,8 @@ private void Initialize()
.AddSingleton(new MapperConfiguration(cfg => cfg.AddMaps(typeof(GetTests).Assembly)))
.AddTransient(sp => new Mapper(sp.GetRequiredService(), sp.GetService))
.AddTransient(sp => new ApplicationBuilder(sp))
- .AddTransient(sp => new RouteBuilder(sp.GetRequiredService()));
+ .AddRouting()
+ .AddLogging();
serviceProvider = services.BuildServiceProvider();
@@ -195,8 +200,7 @@ private ODataQueryOptions GetODataQueryOptions(string query) whe
_oDataQueryOptions = ODataHelpers.GetODataQueryOptions
(
query,
- serviceProvider,
- serviceProvider.GetRequiredService()
+ serviceProvider
);
}
diff --git a/AutoMapper.OData.EFCore.Tests/GetQueryTests.cs b/AutoMapper.OData.EFCore.Tests/GetQueryTests.cs
index 67253ac..1800eb0 100644
--- a/AutoMapper.OData.EFCore.Tests/GetQueryTests.cs
+++ b/AutoMapper.OData.EFCore.Tests/GetQueryTests.cs
@@ -7,7 +7,6 @@
using Microsoft.AspNetCore.OData;
using Microsoft.AspNetCore.OData.Extensions;
using Microsoft.AspNetCore.OData.Query;
-using Microsoft.AspNetCore.Routing;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using System;
@@ -33,7 +32,12 @@ public GetQueryTests()
private void Initialize()
{
IServiceCollection services = new ServiceCollection();
- services.AddOData();
+ IMvcCoreBuilder builder = new TestMvcCoreBuilder
+ {
+ Services = services
+ };
+
+ builder.AddOData();
services.AddDbContext
(
options =>
@@ -46,7 +50,8 @@ private void Initialize()
.AddSingleton(new MapperConfiguration(cfg => cfg.AddMaps(typeof(GetTests).Assembly)))
.AddTransient(sp => new Mapper(sp.GetRequiredService(), sp.GetService))
.AddTransient(sp => new ApplicationBuilder(sp))
- .AddTransient(sp => new RouteBuilder(sp.GetRequiredService()));
+ .AddRouting()
+ .AddLogging();
serviceProvider = services.BuildServiceProvider();
@@ -318,8 +323,7 @@ public async void BuildingExpandBuilderTenantExpandCityFilterOnNestedNestedPrope
ODataQueryOptions options = ODataHelpers.GetODataQueryOptions
(
query,
- serviceProvider,
- serviceProvider.GetRequiredService()
+ serviceProvider
);
Test(Get(query, options));
Test(await GetAsync(query, options));
@@ -379,8 +383,7 @@ public async void BuildingExpandBuilderTenantExpandCityOrderByBuilderNameSkip3Ta
ODataQueryOptions options = ODataHelpers.GetODataQueryOptions
(
query,
- serviceProvider,
- serviceProvider.GetRequiredService()
+ serviceProvider
);
Test(Get(query, options));
Test(await GetAsync(query, options));
@@ -401,8 +404,7 @@ public async void BuildingExpandBuilderTenantExpandCityOrderByBuilderNameSkip3Ta
ODataQueryOptions options = ODataHelpers.GetODataQueryOptions
(
query,
- serviceProvider,
- serviceProvider.GetRequiredService()
+ serviceProvider
);
Test(Get(query, options));
@@ -497,8 +499,7 @@ public async void BuildingWithTopAndSmallerPageSizeNextLink()
ODataQueryOptions options = ODataHelpers.GetODataQueryOptions
(
query,
- serviceProvider,
- serviceProvider.GetRequiredService()
+ serviceProvider
);
Test(Get(query, options, new QuerySettings { ODataSettings = new ODataSettings { HandleNullPropagation = HandleNullPropagationOption.False, PageSize = pageSize } }));
@@ -524,8 +525,7 @@ public async void BuildingWithTopAndLargerPageSizeNextLink()
ODataQueryOptions options = ODataHelpers.GetODataQueryOptions
(
query,
- serviceProvider,
- serviceProvider.GetRequiredService()
+ serviceProvider
);
Test(Get(query, options, new QuerySettings { ODataSettings = new ODataSettings { HandleNullPropagation = HandleNullPropagationOption.False, PageSize = pageSize } }));
@@ -910,8 +910,7 @@ private ODataQueryOptions GetODataQueryOptions(string query) whe
_oDataQueryOptions = ODataHelpers.GetODataQueryOptions
(
query,
- serviceProvider,
- serviceProvider.GetRequiredService()
+ serviceProvider
);
}
diff --git a/AutoMapper.OData.EFCore.Tests/GetTests.cs b/AutoMapper.OData.EFCore.Tests/GetTests.cs
index 536bde8..1107004 100644
--- a/AutoMapper.OData.EFCore.Tests/GetTests.cs
+++ b/AutoMapper.OData.EFCore.Tests/GetTests.cs
@@ -4,10 +4,10 @@
using Domain.OData;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc.ApplicationParts;
using Microsoft.AspNetCore.OData;
using Microsoft.AspNetCore.OData.Extensions;
using Microsoft.AspNetCore.OData.Query;
-using Microsoft.AspNetCore.Routing;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.OData.Edm;
@@ -36,7 +36,12 @@ public GetTests()
private void Initialize()
{
IServiceCollection services = new ServiceCollection();
- services.AddOData();
+ IMvcCoreBuilder builder = new TestMvcCoreBuilder
+ {
+ Services = services
+ };
+
+ builder.AddOData();
services.AddDbContext
(
options =>
@@ -49,7 +54,8 @@ private void Initialize()
.AddSingleton(new MapperConfiguration(cfg => cfg.AddMaps(typeof(GetTests).Assembly)))
.AddTransient(sp => new Mapper(sp.GetRequiredService(), sp.GetService))
.AddTransient(sp => new ApplicationBuilder(sp))
- .AddTransient(sp => new RouteBuilder(sp.GetRequiredService()));
+ .AddRouting()
+ .AddLogging();
serviceProvider = services.BuildServiceProvider();
@@ -209,8 +215,7 @@ public async void BuildingExpandBuilderTenantExpandCityFilterOnNestedNestedPrope
ODataQueryOptions options = ODataHelpers.GetODataQueryOptions
(
query,
- serviceProvider,
- serviceProvider.GetRequiredService()
+ serviceProvider
);
Test(Get(query, options));
Test(await GetAsync(query, options));
@@ -270,8 +275,7 @@ public async void BuildingExpandBuilderTenantExpandCityOrderByBuilderNameSkip3Ta
ODataQueryOptions options = ODataHelpers.GetODataQueryOptions
(
query,
- serviceProvider,
- serviceProvider.GetRequiredService()
+ serviceProvider
);
Test(Get(query, options));
Test(await GetAsync(query, options));
@@ -292,8 +296,7 @@ public async void BuildingExpandBuilderTenantExpandCityOrderByBuilderNameSkip3Ta
ODataQueryOptions options = ODataHelpers.GetODataQueryOptions
(
query,
- serviceProvider,
- serviceProvider.GetRequiredService()
+ serviceProvider
);
Test(Get(query, options));
@@ -388,8 +391,7 @@ public async void BuildingWithTopAndSmallerPageSizeNextLink()
ODataQueryOptions options = ODataHelpers.GetODataQueryOptions
(
query,
- serviceProvider,
- serviceProvider.GetRequiredService()
+ serviceProvider
);
Test(Get(query, options, new QuerySettings { ODataSettings = new ODataSettings { HandleNullPropagation = HandleNullPropagationOption.False, PageSize = pageSize } }));
@@ -415,8 +417,7 @@ public async void BuildingWithTopAndLargerPageSizeNextLink()
ODataQueryOptions options = ODataHelpers.GetODataQueryOptions
(
query,
- serviceProvider,
- serviceProvider.GetRequiredService()
+ serviceProvider
);
Test(Get(query, options, new QuerySettings { ODataSettings = new ODataSettings { HandleNullPropagation = HandleNullPropagationOption.False, PageSize = pageSize } }));
@@ -530,8 +531,7 @@ private ODataQueryOptions GetODataQueryOptions(string query) whe
_oDataQueryOptions = ODataHelpers.GetODataQueryOptions
(
query,
- serviceProvider,
- serviceProvider.GetRequiredService()
+ serviceProvider
);
}
@@ -541,7 +541,7 @@ private ODataQueryOptions GetODataQueryOptions(string query) whe
public static class ODataHelpers
{
- public static ODataQueryOptions GetODataQueryOptions(string queryString, IServiceProvider serviceProvider, IRouteBuilder routeBuilder) where T : class
+ public static ODataQueryOptions GetODataQueryOptions(string queryString, IServiceProvider serviceProvider) where T : class
{
ODataConventionModelBuilder builder = new ODataConventionModelBuilder();
@@ -578,4 +578,10 @@ static HttpRequest BuildRequest(HttpRequest request, Uri uri)
static readonly string BASEADDRESS = "http://localhost:16324";
}
+
+ internal class TestMvcCoreBuilder : IMvcCoreBuilder
+ {
+ public ApplicationPartManager PartManager { get; set; }
+ public IServiceCollection Services { get; set; }
+ }
}
diff --git a/ExpressionBuilder.Tests/ExpressionBuilder.Tests.csproj b/ExpressionBuilder.Tests/ExpressionBuilder.Tests.csproj
index a495892..38b8456 100644
--- a/ExpressionBuilder.Tests/ExpressionBuilder.Tests.csproj
+++ b/ExpressionBuilder.Tests/ExpressionBuilder.Tests.csproj
@@ -8,9 +8,12 @@
-
+
-
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
diff --git a/ExpressionBuilder.Tests/FilterTests.cs b/ExpressionBuilder.Tests/FilterTests.cs
index ba7b1cf..ff7ded5 100644
--- a/ExpressionBuilder.Tests/FilterTests.cs
+++ b/ExpressionBuilder.Tests/FilterTests.cs
@@ -32,7 +32,6 @@ public FilterTests()
private void Initialize()
{
IServiceCollection services = new ServiceCollection();
- services.AddOData();
services.AddTransient(sp => new ApplicationBuilder(sp))
.AddTransient(sp => new RouteBuilder(sp.GetRequiredService()));
diff --git a/Web.Tests/GetTests.cs b/Web.Tests/GetTests.cs
index d968583..ca3ee1d 100644
--- a/Web.Tests/GetTests.cs
+++ b/Web.Tests/GetTests.cs
@@ -34,7 +34,7 @@ private void Initialize()
[Theory]
[InlineData("16324")]
[InlineData("19583")]
- [InlineData("49786")]
+ [InlineData("16325")]
public async void OpsTenantExpandBuildingsFilterEqAndOrderBy(string port)
{
Test(await Get("/opstenant?$top=5&$expand=Buildings&$filter=Name eq 'One'&$orderby=Name desc", port));
@@ -50,7 +50,7 @@ void Test(ICollection collection)
[Theory]
[InlineData("16324")]
[InlineData("19583")]
- [InlineData("49786")]
+ [InlineData("16325")]
public async void OpsTenantExpandBuildingsFilterNeAndOrderBy(string port)
{
Test(await Get("/opstenant?$top=5&$expand=Buildings&$filter=Name ne 'One'&$orderby=Name desc", port));
@@ -66,7 +66,7 @@ void Test(ICollection collection)
[Theory]
[InlineData("16324")]
[InlineData("19583")]
- [InlineData("49786")]
+ [InlineData("16325")]
public async void OpsTenantFilterEqNoExpand(string port)
{
Test(await Get("/opstenant?$filter=Name eq 'One'", port));
@@ -82,7 +82,7 @@ void Test(ICollection collection)
[Theory]
[InlineData("16324")]
[InlineData("19583")]
- [InlineData("49786")]
+ [InlineData("16325")]
public async void OpsTenantFilterGtDateNoExpand(string port)
{
Test(await Get("/opstenant?$filter=CreatedDate gt 2012-11-11T00:00:00.00Z", port));
@@ -98,7 +98,7 @@ void Test(ICollection collection)
[Theory]
[InlineData("16324")]
[InlineData("19583")]
- [InlineData("49786")]
+ [InlineData("16325")]
public async void OpsTenantFilterLtDateNoExpand(string port)
{
Test(await Get("/opstenant?$filter=CreatedDate lt 2012-11-11T12:00:00.00Z", port));
@@ -112,7 +112,7 @@ void Test(ICollection collection)
[Theory]
[InlineData("16324")]
[InlineData("19583")]
- [InlineData("49786")]
+ [InlineData("16325")]
public async void OpsTenantExpandBuildingsNoFilterAndOrderBy(string port)
{
Test(await Get("/opstenant?$top=5&$expand=Buildings&$orderby=Name desc", port));
@@ -128,7 +128,7 @@ void Test(ICollection collection)
[Theory]
[InlineData("16324")]
[InlineData("19583")]
- [InlineData("49786")]
+ [InlineData("16325")]
public async void OpsTenantNoExpandNoFilterAndOrderBy(string port)
{
Test(await Get("/opstenant?$orderby=Name desc", port));
@@ -144,7 +144,7 @@ void Test(ICollection collection)
[Theory]
[InlineData("16324")]
[InlineData("19583")]
- [InlineData("49786")]
+ [InlineData("16325")]
public async void OpsTenantNoExpandFilterEqAndOrderBy(string port)
{
Test(await Get("/opstenant?$top=5&$filter=Name eq 'One'&$orderby=Name desc", port));
@@ -160,7 +160,7 @@ void Test(ICollection collection)
[Theory]//Similar to test below but works if $select=Buildings is added to the query
[InlineData("16324")]
[InlineData("19583")]
- [InlineData("49786")]
+ [InlineData("16325")]
public async void OpsTenantExpandBuildingsSelectNameAndBuilderExpandBuilderExpandCityFilterNeAndOrderBy(string port)
{
Test(await Get("/opstenant?$top=5&$select=Buildings,Name&$expand=Buildings($select=Name,Builder;$expand=Builder($select=Name,City;$expand=City))&$filter=Name ne 'One'&$orderby=Name desc", port));
@@ -179,7 +179,7 @@ void Test(ICollection collection)
[Theory]
[InlineData("16324")]
[InlineData("19583")]
- [InlineData("49786")]
+ [InlineData("16325")]
public async void OpsTenantExpandBuildingsExpandBuilderExpandCityFilterNeAndOrderBy(string port)
{
Test(await Get("/opstenant?$top=5&$expand=Buildings($expand=Builder($expand=City))&$filter=Name ne 'One'&$orderby=Name desc", port));
@@ -197,7 +197,7 @@ void Test(ICollection collection)
[Theory]
[InlineData("16324")]
[InlineData("19583")]
- [InlineData("49786")]
+ [InlineData("16325")]
public async void BuildingExpandBuilderTenantFilterEqAndOrderBy(string port)
{
Test(await Get("/corebuilding?$top=5&$expand=Builder,Tenant&$filter=name eq 'One L1'", port));
@@ -214,7 +214,7 @@ void Test(ICollection collection)
[Theory]
[InlineData("16324")]
[InlineData("19583")]
- [InlineData("49786")]
+ [InlineData("16325")]
public async void BuildingExpandBuilderTenantFilterOnNestedPropertyAndOrderBy(string port)
{
Test(await Get("/corebuilding?$top=5&$expand=Builder,Tenant&$filter=Builder/Name eq 'Sam'&$orderby=Name asc", port));
@@ -231,7 +231,7 @@ void Test(ICollection collection)
[Theory]
[InlineData("16324")]
[InlineData("19583")]
- [InlineData("49786")]
+ [InlineData("16325")]
public async void BuildingExpandBuilderTenantExpandCityFilterOnPropertyAndOrderBy(string port)
{
Test(await Get("/corebuilding?$top=5&$expand=Builder($expand=City),Tenant&$filter=Name ne 'One L2'&$orderby=Name desc", port));
@@ -247,7 +247,7 @@ void Test(ICollection collection)
[Theory]
[InlineData("16324")]
[InlineData("19583")]
- [InlineData("49786")]
+ [InlineData("16325")]
public async void BuildingExpandBuilderTenantExpandCityFilterOnNestedNestedPropertyWithCount(string port)
{
string query = "/corebuilding?$top=5&$expand=Builder($expand=City),Tenant&$filter=Builder/City/Name eq 'Leeds'&$count=true";
@@ -270,7 +270,7 @@ void Test(ICollection collection)
[Theory]
[InlineData("16324")]
[InlineData("19583")]
- [InlineData("49786")]
+ [InlineData("16325")]
public async void BuildingExpandBuilderTenantExpandCityOrderByName(string port)
{
Test(await Get("/corebuilding?$top=5&$expand=Builder($expand=City),Tenant&$orderby=Name desc", port));
@@ -285,7 +285,7 @@ void Test(ICollection collection)
[Theory]
[InlineData("16324")]
[InlineData("19583")]
- [InlineData("49786")]
+ [InlineData("16325")]
public async void BuildingExpandBuilderTenantExpandCityOrderByNameThenByIdentity(string port)
{
Test(await Get("/corebuilding?$top=5&$expand=Builder($expand=City),Tenant&$orderby=Name desc,Identity", port));
@@ -300,7 +300,7 @@ void Test(ICollection collection)
[Theory]
[InlineData("16324")]
[InlineData("19583")]
- [InlineData("49786")]
+ [InlineData("16325")]
public async void BuildingExpandBuilderTenantExpandCityOrderByBuilderName(string port)
{
Test(await Get("/corebuilding?$top=5&$expand=Builder($expand=City),Tenant&$orderby=Builder/Name", port));
@@ -316,7 +316,7 @@ void Test(ICollection collection)
[Theory]
[InlineData("16324")]
[InlineData("19583")]
- [InlineData("49786")]
+ [InlineData("16325")]
public async void BuildingExpandBuilderTenantExpandCityOrderByBuilderNameSkip3Take1WithCount(string port)
{
string query = "/corebuilding?$skip=4&$top=1&$expand=Builder($expand=City),Tenant&$orderby=Name desc,Identity&$count=true";
@@ -340,7 +340,7 @@ void Test(ICollection collection)
[Theory]
[InlineData("16324")]
[InlineData("19583")]
- [InlineData("49786")]
+ [InlineData("16325")]
public async void BuildingExpandBuilderTenantExpandCityOrderByBuilderNameSkip3Take1NoCount(string port)
{
string query = "/corebuilding?$skip=4&$top=1&$expand=Builder($expand=City),Tenant&$orderby=Name desc,Identity";
@@ -364,7 +364,7 @@ void Test(ICollection collection)
[Theory]
[InlineData("16324")]
[InlineData("19583")]
- [InlineData("49786")]
+ [InlineData("16325")]
public async void BuildingSelectName_WithoutOrder_WithoutTop(string port)
{
Test(await Get("/corebuilding?$select=Name", port));
@@ -378,7 +378,7 @@ void Test(ICollection collection)
[Theory]
[InlineData("16324")]
[InlineData("19583")]
- [InlineData("49786")]
+ [InlineData("16325")]
public async void OpsTenantOrderByCountOfReference(string port)
{
Test(await Get("/opstenant?$expand=Buildings&$orderby=Buildings/$count desc", port));
@@ -397,7 +397,7 @@ void Test(ICollection collection)
[InlineData("16324")]
//EF 6 seems to have a problem with circular reference Building/Tenant/Buildings
//[InlineData("19583")]
- //[InlineData("49786")]
+ //[InlineData("16325")]
public async void CoreBuildingOrderByCountOfChildReferenceOfReference(string port)
{
Test(await Get("/corebuilding?$expand=Tenant($expand=Buildings)&$orderby=Tenant/Buildings/$count desc", port));
@@ -413,7 +413,7 @@ void Test(ICollection collection)
[Theory]
[InlineData("16324")]
[InlineData("19583")]
- [InlineData("49786")]
+ [InlineData("16325")]
public async void CoreBuildingOrderByPropertyOfChildReferenceOfReference(string port)
{
Test(await Get("/corebuilding?$expand=Builder($expand=City)&$orderby=Builder/City/Name desc", port));
@@ -429,7 +429,7 @@ void Test(ICollection collection)
[Theory]
[InlineData("16324")]
[InlineData("19583")]
- [InlineData("49786")]
+ [InlineData("16325")]
public async void OpsTenantSelectName(string port)
{
Test(await Get("/opstenant?$select=Name&$expand=Buildings&$orderby=Name", port));
@@ -446,7 +446,7 @@ void Test(ICollection collection)
[Theory]
[InlineData("16324")]
[InlineData("19583")]
- [InlineData("49786")]
+ [InlineData("16325")]
public async void OpsTenantExpandBuildingsFilterEqAndOrderBy_FirstBuildingHasValues(string port)
{
Test(await Get("/opstenant?$top=5&$select=Buildings&$expand=Buildings&$filter=Name eq 'One'&$orderby=Name desc", port));
@@ -465,7 +465,7 @@ void Test(ICollection collection)
[Theory]
[InlineData("16324")]
[InlineData("19583")]
- [InlineData("49786")]
+ [InlineData("16325")]
public async void BuildingSelectNameExpandBuilder_Builder_ShouldBeNull(string port)
{
Test(await Get("/corebuilding?$top=5&$select=Name&$expand=Builder($select=Name)&$filter=name eq 'One L1'", port));
@@ -482,7 +482,7 @@ void Test(ICollection collection)
[Theory]
[InlineData("16324")]
[InlineData("19583")]
- [InlineData("49786")]
+ [InlineData("16325")]
public async void BuildingExpandBuilderSelectNamefilterEqAndOrderBy(string port)
{
Test(await Get("/corebuilding?$top=5&$expand=Builder($select=Name)&$filter=name eq 'One L1'", port));
@@ -501,7 +501,7 @@ void Test(ICollection collection)
[Theory]
[InlineData("16324")]
[InlineData("19583")]
- [InlineData("49786")]
+ [InlineData("16325")]
public async void BuildingExpandBuilderSelectNameExpandCityFilterEqAndOrderBy_CityShouldBeNull_BuilderNameShouldeSam_BuilderIdShouldBeZero(string port)
{
Test(await Get("/corebuilding?$top=5&$expand=Builder($select=Name;$expand=City)&$filter=name eq 'One L1'", port));
@@ -520,7 +520,7 @@ void Test(ICollection collection)
[Theory]
[InlineData("16324")]
[InlineData("19583")]
- [InlineData("49786")]
+ [InlineData("16325")]
public async void OpsTenantExpandBuildingsSelectNameAndBuilderExpandBuilderExpandCityFilterNeAndOrderBy_filterAndSortChildCollection(string port)
{
Test(await Get("/opstenant?$top=5&$select=Buildings,Name&$expand=Buildings($filter=Name ne 'Two L1';$orderby=Name;$select=Name,Builder;$expand=Builder($select=Name,City;$expand=City))&$filter=Name ne 'One'&$orderby=Name desc", port));
@@ -540,7 +540,7 @@ void Test(ICollection collection)
[Theory]
[InlineData("16324")]
[InlineData("19583")]
- [InlineData("49786")]
+ [InlineData("16325")]
public async void OpsTenantExpandBuildingsExpandBuilderExpandCityFilterNeAndOrderBy_filterAndSortChildCollection(string port)
{
Test(await Get("/opstenant?$top=5&$expand=Buildings($filter=Name ne '';$orderby=Name desc;$expand=Builder($expand=City))&$filter=Name ne 'One'&$orderby=Name desc", port));
diff --git a/Web.Tests/Web.Tests.csproj b/Web.Tests/Web.Tests.csproj
index 0509200..76718a0 100644
--- a/Web.Tests/Web.Tests.csproj
+++ b/Web.Tests/Web.Tests.csproj
@@ -9,10 +9,13 @@
-
+
-
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
diff --git a/WebAPI.AspNet.OData.EF6/WebAPI.AspNet.OData.EF6.csproj b/WebAPI.AspNet.OData.EF6/WebAPI.AspNet.OData.EF6.csproj
index e2e3869..fa9048c 100644
--- a/WebAPI.AspNet.OData.EF6/WebAPI.AspNet.OData.EF6.csproj
+++ b/WebAPI.AspNet.OData.EF6/WebAPI.AspNet.OData.EF6.csproj
@@ -122,7 +122,7 @@
- 2.2.0-preview.1
+ 2.2.0-preview.1.2
4.1.1
@@ -179,7 +179,7 @@
4.5.0
- 5.11.1
+ 5.11.10
diff --git a/WebAPI.OData.EF6/Properties/launchSettings.json b/WebAPI.OData.EF6/Properties/launchSettings.json
index ac99840..ea15f94 100644
--- a/WebAPI.OData.EF6/Properties/launchSettings.json
+++ b/WebAPI.OData.EF6/Properties/launchSettings.json
@@ -4,7 +4,7 @@
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
- "applicationUrl": "http://localhost:49786",
+ "applicationUrl": "http://localhost:16325",
"sslPort": 0
}
},
diff --git a/WebAPI.OData.EF6/Startup.cs b/WebAPI.OData.EF6/Startup.cs
index df3f36e..ee02bac 100644
--- a/WebAPI.OData.EF6/Startup.cs
+++ b/WebAPI.OData.EF6/Startup.cs
@@ -24,8 +24,7 @@ public Startup(IConfiguration configuration)
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
- services.AddControllers();
- services.AddOData(opt => opt.AddModel("", GetEdmModel()).Count().Filter().OrderBy().Expand().Select().SetMaxTop(null));
+ services.AddControllers().AddOData(opt => opt.AddRouteComponents("", GetEdmModel()).Count().Filter().OrderBy().Expand().Select().SetMaxTop(null));
services.AddScoped
(
_ => new MyDbContext
diff --git a/WebAPI.OData.EF6/WebAPI.OData.EF6.csproj b/WebAPI.OData.EF6/WebAPI.OData.EF6.csproj
index 1c98618..724eba0 100644
--- a/WebAPI.OData.EF6/WebAPI.OData.EF6.csproj
+++ b/WebAPI.OData.EF6/WebAPI.OData.EF6.csproj
@@ -5,7 +5,7 @@
-
+
diff --git a/WebAPI.OData.EFCore/Startup.cs b/WebAPI.OData.EFCore/Startup.cs
index 4eac0ef..d627ce6 100644
--- a/WebAPI.OData.EFCore/Startup.cs
+++ b/WebAPI.OData.EFCore/Startup.cs
@@ -26,8 +26,7 @@ public Startup(IConfiguration configuration)
public void ConfigureServices(IServiceCollection services)
{
services.AddDbContext(options => options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
- services.AddControllers();
- services.AddOData(opt => opt.AddModel("", GetEdmModel()).Count().Filter().OrderBy().Expand().Select().SetMaxTop(null));
+ services.AddControllers().AddOData(opt => opt.AddRouteComponents("", GetEdmModel()).Count().Filter().OrderBy().Expand().Select().SetMaxTop(null));
services.AddSingleton
(
diff --git a/WebAPI.OData.EFCore/WebAPI.OData.EFCore.csproj b/WebAPI.OData.EFCore/WebAPI.OData.EFCore.csproj
index 8b5e91c..2e04c49 100644
--- a/WebAPI.OData.EFCore/WebAPI.OData.EFCore.csproj
+++ b/WebAPI.OData.EFCore/WebAPI.OData.EFCore.csproj
@@ -5,7 +5,7 @@
-
+