Some of my entities have navigation properties as they have a foreign key to another entity in the database. In my code, I've set the primary keys of the navigation properties to link the entities with each other.
The problem is that entity framework sees this as a new entity and tries to add it to the database with next error as a result:
Cannot insert explicit value for identity column in table 'xxx' when IDENTITY_INSERT is set to OFF.
Obviously, because the entity is new and not acquired from the database.
Is there a way in EF to remove the tracking of the entity?