-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
It doesn't work with .NET 6 #2
Comments
Facing Same problem |
same here |
For me this code worked in .net 6, I only had to update the OnBeforeSaveChanges method. In the updated code, entry.Metadata.GetTableName() is used to get the table name instead of entry.Entity.GetType().Name. Also, entry.State and entry.Properties are accessed through ChangeTracker.Entries() and property.Metadata is used instead of property.
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
"System.MissingMethodException: Method not found: 'System.String Microsoft.EntityFrameworkCore.Metadata.IPropertyBase.get_Name()'.
at AspNetCoreHero.EntityFrameworkCore.AuditTrail.AuditableContext.OnBeforeSaveChanges(String userId)
at AspNetCoreHero.EntityFrameworkCore.AuditTrail.AuditableContext.SaveChangesAsync(String userId)
at StoreManager.Infrastructure.DbContexts.ApplicationDbContext.SaveChangesAsync(CancellationToken cancellationToken) in D:\All_Web\Research\StoreManager\StoreManager\StoreManager.Infrastructure\DbContexts\ApplicationDbContext.cs:line 54
at StoreManager.Infrastructure.Repositories.UnitOfWork.Commit(CancellationToken cancellationToken) in D:\All_Web\Research\StoreManager\StoreManager\StoreManager.Infrastructure\Repositories\UnitOfWork.cs:line 24
at StoreManager.Application.Features.Brands.Commands.Create.CreateBrandCommandHandler.Handle(CreateBrandCommand request, CancellationToken cancellationToken) in D:\All_Web\Research\StoreManager\StoreManager\StoreManager.Application\Features\Brands\Commands\Create\CreateBrandCommand.cs:line 36
at MediatR.Pipeline.RequestExceptionProcessorBehavior
2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate
1 next)at MediatR.Pipeline.RequestExceptionProcessorBehavior
2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate
1 next)at MediatR.Pipeline.RequestExceptionActionProcessorBehavior
2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate
1 next)at MediatR.Pipeline.RequestExceptionActionProcessorBehavior
2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate
1 next)at MediatR.Pipeline.RequestPostProcessorBehavior
2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate
1 next)at MediatR.Pipeline.RequestPreProcessorBehavior
2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate
1 next)at StoreManager.Web.Areas.Catalog.Controllers.BrandController.OnPostCreateOrEdit(Int32 id, BrandViewModel brand) in D:\All_Web\Research\StoreManager\StoreManager\StoreManager.Web\Areas\Catalog\Controllers\BrandController.cs:line 63
at lambda_method492(Closure , Object )
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
at Microsoft.AspNetCore.Routing.EndpointMiddleware.g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
at Microsoft.AspNetCore.Authorization.Policy.AuthorizationMiddlewareResultHandler.HandleAsync(RequestDelegate next, HttpContext context, AuthorizationPolicy policy, PolicyAuthorizationResult authorizeResult)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context)
at AspNetCoreHero.ToastNotification.Middlewares.NotyfMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<b__1>d.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
The text was updated successfully, but these errors were encountered: