InvalidOperationException: The property 'Id' on entity type 'Customer' has a temporary value while attempting to change the entity's state to 'Unchang

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
5 years ago
Hi,

I am working on nopcommerce project and trying to develop new features to my own shop at my local machine. Nopcommerce suddenly started to display this error  at website's Homepage. My development is not related with Customer table or it's entities. I can't trace exception's source. Please help.

"An unhandled exception occurred while processing the request.
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, line 83

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
-
                            EngineContext.Current.Resolve<ILogger>().Error(exception.Message, exception, currentCustomer);
                        }
                    }
                    finally
                    {
                        //rethrow the exception to show the error page
                        throw exception;
                    }
                });
            });
        }
        /// <summary>
Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
5 years ago
I have the same issue please help...
5 years ago
Hi boutroux i solved problem myself. Please check using of your method. I was using a method created for administrator section. That was source of my problem.

Cheers
5 years ago
I resolved by myself too, in my case was a bad and old trigger on the address table of customer.

Thanks anyway...

cheers.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.