I am integrating my windows application with nopcommerce. So In that when I register the customer from nopcommerce then all the info should be saved to new table Customer
of my windows app. for that I created trigger after insert on Table GenericAttribute
.
But when I am going to register customer then error occurs in following schema at EfRepository.cs
:
protected string GetFullErrorTextAndRollbackEntityChanges(DbUpdateException exception)
{
//rollback entity changes
if (_context is DbContext dbContext)
{
var entries = dbContext.ChangeTracker.Entries()
.Where(e => e.State == EntityState.Added || e.State == EntityState.Modified).ToList();
entries.ForEach(entry => entry.State = EntityState.Unchanged); //here error occurs
}
_context.SaveChanges();
return exception.ToString();
}
and the Error is :
InvalidOperationException
: The property 'Id
' on entity type 'GenericAttribute
' 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