Error On Guest Customer Insert

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
5 anos atrás
InvalidOperationException: The property 'Id' on entity type 'Customer' has a temporary value while attempting to change the entity's state to 'Unchanged'. Either set a permanent value explicitly or ensure that the database is configured to generate values for this property.
Nop.Web.Framework.Infrastructure.Extensions.ApplicationBuilderExtensions+<>c.<UseNopExceptionHandler>b__1_1(HttpContext context) in ApplicationBuilderExtensions.cs
Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)


Please Help
5 anos atrás
Any update on this or on same post ?
5 anos atrás
probably you are leaving not nullable item as null or empty
5 anos atrás
I’m getting same error during insert Product from plugin.

If I insert new product from admin area, it’s working fine.
5 anos atrás
rajupaladiya wrote:
I’m getting same error during insert Product from plugin.

If I insert new product from admin area, it’s working fine.



I was having the same issue as well, for test fill every item and try like that. I was using kendo autocomplete and when i left that area empty had same error. after filling it no error.
5 anos atrás
Hi It’s worked.

I prepare again model and pass in service with required values and it’s work.

Thank You
5 anos atrás
rajupaladiya wrote:
Hi It’s worked.

I prepare again model and pass in service with required values and it’s work.

Thank You


yw. EF Core 2 is kinda interesting :)
5 anos atrás
I was running into this issue when starting a new threaded task.
                
var process = new Thread(delegate ()
                {
                    using (var scope = _serviceScopeFactory.CreateScope())
                    {
                        var prepareDatabaseService = scope.ServiceProvider.GetService<IPrepareDatabaseService>();
                        prepareDatabaseService.PrepareDatabase(out resultSuccess);
                    }
                });
                process.Start();

The service was configured as SingleInstance. When I changed it to InstancePerLifetimeScope, it worked without throwing any exceptions.

It may not apply to everyone but can be something to check if you are using your own service.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.