Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.x
dotnet-version: 11.x

- name: Set Variables
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.x
dotnet-version: 11.x

- name: Set Variables
run: |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net8.0;net9.0;net10.0</TargetFrameworks>
<TargetFrameworks>net10.0;net11.0</TargetFrameworks>
<RootNamespace>AutoMapper.AspNet.OData</RootNamespace>
<PackageId>AutoMapper.AspNetCore.OData.EFCore</PackageId>
<Description>Creates LINQ expressions from ODataQueryOptions and executes the query.</Description>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<PackageReleaseNotes>Removing obsolete methods and using the latest version of AutoMapper.Extensions.ExpressionMapping. Ending maintenance for AutoMapper.AspNetCore.OData.EF6.</PackageReleaseNotes>
<PackageReleaseNotes>Supporting AutoMapper v17 and .NET v11.</PackageReleaseNotes>
<PackageTags>linq expressions odata efcore</PackageTags>
<PackageIcon>icon.png</PackageIcon>
<RepositoryUrl>https://github.com/AutoMapper/AutoMapper.Extensions.OData</RepositoryUrl>
Expand All @@ -30,26 +30,22 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="AutoMapper.Extensions.ExpressionMapping" Version="[11.0.0,12.0.0)" />
<PackageReference Include="LogicBuilder.Expressions.Utils" Version="8.0.0" />
<PackageReference Include="Microsoft.AspNetCore.OData" Version="9.4.1" />
<PackageReference Include="MinVer" Version="6.0.0">
<PackageReference Include="AutoMapper.Extensions.ExpressionMapping" Version="[12.0.0,13.0.0)" />
<PackageReference Include="LogicBuilder.Expressions.Utils" Version="8.0.3" />
<PackageReference Include="Microsoft.AspNetCore.OData" Version="9.5.0" />
<PackageReference Include="MinVer" Version="8.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="11.0.100" PrivateAssets="All" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net8.0' ">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.22" />
<ItemGroup Condition=" '$(TargetFramework)' == 'net10.0' ">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="10.0.15" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net9.0' ">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.11" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net10.0' ">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="10.0.5" />
<ItemGroup Condition=" '$(TargetFramework)' == 'net11.0' ">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="11.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions AutoMapper.Extensions.OData.sln
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
ProjectSection(SolutionItems) = preProject
.github\workflows\ci.yml = .github\workflows\ci.yml
Directory.Build.props = Directory.Build.props
global.json = global.json
Pack_Push.ps1 = Pack_Push.ps1
.github\workflows\release.yml = .github\workflows\release.yml
EndProjectSection
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFrameworks>net10.0</TargetFrameworks>
<TargetFrameworks>net11.0</TargetFrameworks>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="10.0.5" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.3.0" />
<PackageReference Include="xunit.v3" Version="3.2.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="11.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.12.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
<PackageReference Include="xunit.v3" Version="4.0.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="4.0.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
14 changes: 5 additions & 9 deletions DAL.EFCore/DAL.EFCore.csproj
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net8.0;net9.0;net10.0</TargetFrameworks>
<TargetFrameworks>net10.0;net11.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net8.0' ">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.11" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net9.0' ">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.0" />
<ItemGroup Condition=" '$(TargetFramework)' == 'net10.0' ">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="10.0.15" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net10.0' ">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="10.0.0" />
<ItemGroup Condition=" '$(TargetFramework)' == 'net11.0' ">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="11.0.0" />
</ItemGroup>

</Project>
8 changes: 4 additions & 4 deletions ExpressionBuilder.Tests/ExpressionBuilder.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFrameworks>net10.0</TargetFrameworks>
<TargetFrameworks>net11.0</TargetFrameworks>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.3.0" />
<PackageReference Include="xunit.v3" Version="3.2.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.12.0" />
<PackageReference Include="xunit.v3" Version="4.0.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="4.0.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
12 changes: 6 additions & 6 deletions ExpressionBuilder.Tests/FilterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1327,9 +1327,9 @@ public void TimeOnlyFunctions_NonNullable(string filterString, string expression
}

[Theory]
[InlineData("fractionalseconds(DiscontinuedDate) eq 0.2", "$it => ((Convert($it.DiscontinuedDate.Value.Millisecond) / 1000) == 0.2)")]
[InlineData("fractionalseconds(NullableTimeOfDayProperty) eq 0.2", "$it => ((Convert($it.NullableTimeOfDayProperty.Value.Milliseconds) / 1000) == 0.2)")]
[InlineData("fractionalseconds(NullableTimeOnlyProperty) eq 0.2", "$it => ((Convert($it.NullableTimeOnlyProperty.Value.Millisecond) / 1000) == 0.2)")]
[InlineData("fractionalseconds(DiscontinuedDate) eq 0.2", "$it => ((Convert($it.DiscontinuedDate.Value.Millisecond) / 1000) == 0.20000000298023223876953125)")]//OData FilterCluase constant returns higher precision in .NET 11
[InlineData("fractionalseconds(NullableTimeOfDayProperty) eq 0.2", "$it => ((Convert($it.NullableTimeOfDayProperty.Value.Milliseconds) / 1000) == 0.20000000298023223876953125)")]
[InlineData("fractionalseconds(NullableTimeOnlyProperty) eq 0.2", "$it => ((Convert($it.NullableTimeOnlyProperty.Value.Millisecond) / 1000) == 0.20000000298023223876953125)")]
public void FractionalsecondsFunction_Nullable(string filterString, string expression)
{
//act
Expand All @@ -1340,9 +1340,9 @@ public void FractionalsecondsFunction_Nullable(string filterString, string expre
}

[Theory]
[InlineData("fractionalseconds(NonNullableDiscontinuedDate) eq 0.2", "$it => ((Convert($it.NonNullableDiscontinuedDate.Millisecond) / 1000) == 0.2)")]
[InlineData("fractionalseconds(TimeOfDayProperty) eq 0.2", "$it => ((Convert($it.TimeOfDayProperty.Milliseconds) / 1000) == 0.2)")]
[InlineData("fractionalseconds(TimeOnlyProperty) eq 0.2", "$it => ((Convert($it.TimeOnlyProperty.Millisecond) / 1000) == 0.2)")]
[InlineData("fractionalseconds(NonNullableDiscontinuedDate) eq 0.2", "$it => ((Convert($it.NonNullableDiscontinuedDate.Millisecond) / 1000) == 0.20000000298023223876953125)")]//OData FilterCluase constant returns higher precision in .NET 11
[InlineData("fractionalseconds(TimeOfDayProperty) eq 0.2", "$it => ((Convert($it.TimeOfDayProperty.Milliseconds) / 1000) == 0.20000000298023223876953125)")]
[InlineData("fractionalseconds(TimeOnlyProperty) eq 0.2", "$it => ((Convert($it.TimeOnlyProperty.Millisecond) / 1000) == 0.20000000298023223876953125)")]
public void FractionalsecondsFunction_NonNullable(string filterString, string expression)
{
//act
Expand Down
10 changes: 5 additions & 5 deletions MigrationTool/MigrationTool.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<TargetFramework>net11.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="10.0.0">
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="11.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="10.0.0" />
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" Version="8.2.1" />
<PackageReference Include="Microsoft.IdentityModel.Protocols.OpenIdConnect" Version="8.2.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="11.0.0" />
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" Version="8.23.0" />
<PackageReference Include="Microsoft.IdentityModel.Protocols.OpenIdConnect" Version="8.23.0" />
</ItemGroup>

<ItemGroup>
Expand Down
8 changes: 4 additions & 4 deletions SeedDatabase/SeedDatabase.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<TargetFramework>net11.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="10.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="10.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="10.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="11.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="11.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="11.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
14 changes: 7 additions & 7 deletions Web.Tests/Web.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net11.0</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="9.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.3.0" />
<PackageReference Include="xunit.v3" Version="3.2.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="11.0.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="11.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.12.0" />
<PackageReference Include="xunit.v3" Version="4.0.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="4.0.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
75 changes: 55 additions & 20 deletions WebAPI.OData.EFCore/Program.cs
Original file line number Diff line number Diff line change
@@ -1,24 +1,59 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using AutoMapper;
using DAL.EFCore;
using Domain.OData;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.OData;
using Microsoft.AspNetCore.OData.Query.Expressions;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.OData.Edm;
using Microsoft.OData.ModelBuilder;
using WebAPI.OData.EFCore.Binders;
using WebAPI.OData.EFCore.Controllers;

namespace WebAPI.OData.EFCore
{
public class Program
var builder = WebApplication.CreateBuilder(args);

builder.Services.AddDbContext<MyDbContext>(options => options.UseSqlServer(builder.Configuration.GetConnectionString("DefaultConnection")));
builder.Services.AddControllers()
.AddOData(opt => opt.EnableQueryFeatures()
.AddRouteComponents("", GetEdmModel(), services => services.AddSingleton<ISearchBinder, OpsTenantSearchBinder>()));
builder.Services.AddSingleton<AutoMapper.IConfigurationProvider>
(
new MapperConfiguration(cfg =>
{
public static void Main(string[] args)
{
CreateWebHostBuilder(args).Build().Run();
}

public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>();
}
cfg.AddMaps(typeof(ValuesController).Assembly);
cfg.AllowNullCollections = true;
}, new NullLoggerFactory())
)
.AddScoped<IMapper>(sp => new Mapper(sp.GetRequiredService<AutoMapper.IConfigurationProvider>(), sp.GetService));

var app = builder.Build();

if (builder.Environment.EnvironmentName == "Development")
{
app.UseDeveloperExceptionPage();
}

app.UseHttpsRedirection();

app.UseRouting();

app.UseAuthorization();

app.MapControllers();

await app.RunAsync();

static IEdmModel GetEdmModel()
{
var builder = new ODataConventionModelBuilder();
builder.EnableLowerCamelCase();
builder.EntitySet<OpsTenant>(nameof(OpsTenant));
builder.EntitySet<CoreBuilding>(nameof(CoreBuilding));
builder.EntitySet<OpsBuilder>(nameof(OpsBuilder));
builder.EntitySet<OpsCity>(nameof(OpsCity));

return builder.GetEdmModel();
}
80 changes: 0 additions & 80 deletions WebAPI.OData.EFCore/Startup.cs

This file was deleted.

Loading
Loading