I'm just starting using Audit.NET. I download the template from
dotnet new -i Audit.WebApi.Template
dotnet new webapiaudit -E
Unfortunately, the project doesn't work. When I post a value, I have an internal server error. The description is quite long but basically the error is
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware: Error: An unhandled exception has occurred while executing the request. System.TypeLoadException: Could not load type 'Microsoft.EntityFrameworkCore.Internal.EnumerableExtensions' from assembly 'Microsoft.EntityFrameworkCore, Version=5.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. at Microsoft.EntityFrameworkCore.RelationalPropertyExtensions.FindSharedTable. RootPrimaryKeyProperty(IProperty property) at Microsoft.EntityFrameworkCore.RelationalPropertyExtensions.GetDefaultColumnName(IProperty property) at Microsoft.EntityFrameworkCore.RelationalPropertyExtensions.GetColumnName(IProperty property) at Audit.EntityFramework.DbContextHelper.GetColumnName(IProperty prop) at Audit.EntityFramework.DbContextHelper.GetColumnValues(IAuditDbContext context, EntityEntry entry) at Audit.EntityFramework.DbContextHelper.CreateAuditEvent(IAuditDbContext context) at Audit.EntityFramework.DbContextHelper.SaveChangesAsync(IAuditDbContext context, Func`1 baseSaveChanges) at Projects.Providers.ValuesProvider.InsertAsync(String value) in C:\Projects\AuditNetWebapi\Providers\ValuesProvider.cs:line 32 at Projects.Controllers.ValuesController.Post(String value) in C:\Projects\AuditNetWebapi\Controllers\ValuesController.cs:line 40
Do you have any ideas? Are there templates projects from ASP.NET or Console?
I have created a repo on GitHub with the project.
I think this is because you are targetting a newer version of EF.Core than the current supported by Audit.EntityFramework.Core which is 3.1.0.
Could you open an issue here?
Update
This was fixed on version 16.3.0, now the library
Audit.EntityFramework.Core
is compatible with EF Core 5.0.1