Assigning ids to entities with EntityFramework 4
问题 I'd like to implement "default" Id generation support for my entities. When saving the entity, I'd like EntityFramework to only generate the id value for the Entity if it's not already set. If the ID already has a non-null, non-zero value, I want to have that entity ID preserved when the entity is saved in the database. I'm migrating data from a legacy data model (EntityFramework model created from the old database) to a newly created (model-first) EntityFramework model. Let's call the old