more than one entity of type 'Model' have the same primary key value -
i try insert "person" database after initialization problem:
an exception of type 'system.invalidoperationexception' occurred in entityframework.dll not handled in user code additional information: saving or accepting changes failed because more 1 entity of type 'myproject.entities.models.person' have same primary key value. ensure explicitly set primary key values unique. ensure database-generated primary keys configured correctly in database , in entity framework model. use entity designer database first/model first configuration. use 'hasdatabasegeneratedoption" fluent api or 'databasegeneratedattribute' code first configuration.
in line :
private void syncobjectsstateprecommit() { foreach (var dbentityentry in changetracker.entries()) { dbentityentry.state = statehelper.convertstate(((iobjectstate)dbentityentry.entity).objectstate); } }
how can deal please problem thanks
Comments
Post a Comment