diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index 8b1ff77..da2505d 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -37,7 +37,7 @@ jobs: uses: actions/checkout@v2 - uses: actions/setup-dotnet@v1 with: - dotnet-version: '6.0.x' + dotnet-version: '8.0.x' - name: Build Nuget Package run: dotnet pack -c Release azure-documentdb-odata-sql\azure-documentdb-odata-sql.csproj -o . /p:NuspecFile=azure-documentdb-odata-sql.nuspec /p:Version=${{needs.versioning.outputs.version}} /p:NuspecProperties="version=${{needs.versioning.outputs.version}}" /p:PackageID=Lambda.Azure.CosmosDb.OData.Sql - name: Push NuGet Package diff --git a/.github/workflows/pullrequest.yml b/.github/workflows/pullrequest.yml index b77146b..da8702a 100644 --- a/.github/workflows/pullrequest.yml +++ b/.github/workflows/pullrequest.yml @@ -12,7 +12,7 @@ jobs: uses: actions/checkout@v2 - uses: actions/setup-dotnet@v1 with: - dotnet-version: '6.0.x' + dotnet-version: '8.0.x' - name: Build project run: dotnet build azure-documentdb-odata-sql.sln - name: Run tests diff --git a/README.md b/README.md index 42deaad..3a47609 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,9 @@ For example: ## Release Notes +* 5.0.x + * No logic change + * Added support for .Net 8 * 4.2.x * Fixed an issue with `any` not being detected correctly * 4.1.x diff --git a/azure-documentdb-odata-sql-samples/ODataToSqlSamples.cs b/azure-documentdb-odata-sql-samples/ODataToSqlSamples.cs index 55db463..8aaf5fc 100644 --- a/azure-documentdb-odata-sql-samples/ODataToSqlSamples.cs +++ b/azure-documentdb-odata-sql-samples/ODataToSqlSamples.cs @@ -7,7 +7,7 @@ using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Builder; -#if NET6_0 +#if NET6_0 || NET8_0 using Microsoft.AspNetCore.OData; using Microsoft.AspNetCore.OData.Query.Validator; using Microsoft.OData.ModelBuilder; @@ -56,9 +56,9 @@ public static void ClassInitialize(TestContext testContext) var collection = new ServiceCollection(); -#if NET6_0 - collection - .AddControllers() +#if NET6_0 || NET8_0 + collection + .AddControllers() .AddOData(); #else collection.AddOData(); @@ -72,8 +72,8 @@ public static void ClassInitialize(TestContext testContext) collection.AddTransient(); collection.AddTransient(); -#if NET6_0 - collection.AddTransient(); +#if NET6_0 || NET8_0 + collection.AddTransient(); #endif Provider = collection.BuildServiceProvider(); @@ -81,14 +81,14 @@ public static void ClassInitialize(TestContext testContext) var applicationBuilder = Substitute.For(); applicationBuilder.ApplicationServices.Returns(Provider); -#if !NET6_0 +#if !NET6_0 && !NET8_0 var routeBuilder = new RouteBuilder(applicationBuilder); routeBuilder.EnableDependencyInjection(); #endif - } + } - // Use TestInitialize to run code before running each test - [TestInitialize()] + // Use TestInitialize to run code before running each test + [TestInitialize()] public void TestInitialize() { HttpRequest = new DefaultHttpRequest(new DefaultHttpContext @@ -637,8 +637,12 @@ public void TranslateAnyToJoin_WhenThereIsOneNestedjoinWithComplexPath() var oDataToSqlTranslator = new ODataToSqlTranslator(new SQLQueryFormatter()); var sqlQuery = oDataToSqlTranslator.Translate(oDataQueryOptions, TranslateOptions.ALL & ~TranslateOptions.TOP_CLAUSE); - Assert.AreEqual("SELECT VALUE c FROM c JOIN l IN c.payload.bet.legs JOIN o IN l.outcomes WHERE o.id = 'test' ", sqlQuery); - } +#if NET8_0 + Assert.AreEqual("SELECT VALUE c FROM c JOIN l IN c.payload.bet.legs JOIN o IN l.legs.outcomes WHERE o.id = 'test' ", sqlQuery); +#else + Assert.AreEqual("SELECT VALUE c FROM c JOIN l IN c.payload.bet.legs JOIN o IN l.outcomes WHERE o.id = 'test' ", sqlQuery); +#endif + } [TestMethod] public void TranslateEnum_WhenClassDoestHaveId() @@ -755,10 +759,17 @@ public void TranslateAnyToJoin_WhenThereIsOneNestedjoinAndConditionBasedOnChildP var sqlQuery = oDataToSqlTranslator.Translate(oDataQueryOptions, TranslateOptions.ALL & ~TranslateOptions.TOP_CLAUSE); - Assert.AreEqual( + +#if NET8_0 + Assert.AreEqual( + "SELECT VALUE c FROM c JOIN l IN c.payload.bet.legs JOIN o IN l.legs.outcomes WHERE o.competitor.id = 'test' ", + sqlQuery); +#else + Assert.AreEqual( "SELECT VALUE c FROM c JOIN l IN c.payload.bet.legs JOIN o IN l.outcomes WHERE o.competitor.id = 'test' ", sqlQuery); - } +#endif + } [TestMethod] public void TranslateAnyToJoin_ReturnsCorrectResult_WhenQueryIsBasedOnANestedProperty() @@ -880,8 +891,8 @@ private static ODataQueryOptions GetODataQueryOptions(string oData) #endregion } -#if NET6_0 - public class TestLoggingFactory : Microsoft.Extensions.Logging.ILoggerFactory +#if NET6_0 || NET8_0 + public class TestLoggingFactory : Microsoft.Extensions.Logging.ILoggerFactory { private readonly ILogger logger = Substitute.For(); public void Dispose() diff --git a/azure-documentdb-odata-sql-samples/azure-documentdb-odata-sql-samples.csproj b/azure-documentdb-odata-sql-samples/azure-documentdb-odata-sql-samples.csproj index c14c641..91d1642 100644 --- a/azure-documentdb-odata-sql-samples/azure-documentdb-odata-sql-samples.csproj +++ b/azure-documentdb-odata-sql-samples/azure-documentdb-odata-sql-samples.csproj @@ -1,7 +1,7 @@  - net462;net6.0 + net462;net6.0;net8.0 full @@ -30,7 +30,16 @@ - + + + + + + + + + + diff --git a/azure-documentdb-odata-sql/ODataToSqlTranslator/ODataToSqlTranslator.cs b/azure-documentdb-odata-sql/ODataToSqlTranslator/ODataToSqlTranslator.cs index 566b9b4..7f24a50 100644 --- a/azure-documentdb-odata-sql/ODataToSqlTranslator/ODataToSqlTranslator.cs +++ b/azure-documentdb-odata-sql/ODataToSqlTranslator/ODataToSqlTranslator.cs @@ -13,7 +13,7 @@ using Microsoft.AspNet.OData.Query; #endif -#if NET6_0 +#if NET6_0 || NET8_0 using Microsoft.AspNetCore.OData.Query; #endif diff --git a/azure-documentdb-odata-sql/azure-documentdb-odata-sql.csproj b/azure-documentdb-odata-sql/azure-documentdb-odata-sql.csproj index dfe8cb2..25a68be 100644 --- a/azure-documentdb-odata-sql/azure-documentdb-odata-sql.csproj +++ b/azure-documentdb-odata-sql/azure-documentdb-odata-sql.csproj @@ -1,7 +1,7 @@  - netstandard2.0;net6.0 + netstandard2.0;net6.0;net8.0 Microsoft.Azure.Documents.OData.Sql @@ -25,4 +25,9 @@ + + + + + diff --git a/azure-documentdb-odata-sql/azure-documentdb-odata-sql.nuspec b/azure-documentdb-odata-sql/azure-documentdb-odata-sql.nuspec index 16d91ee..11df410 100644 --- a/azure-documentdb-odata-sql/azure-documentdb-odata-sql.nuspec +++ b/azure-documentdb-odata-sql/azure-documentdb-odata-sql.nuspec @@ -28,16 +28,23 @@ + + + - - + + + + + +