I haven't fully tested that this is an issue but I wanted to capture it before I forget:
- With the current design we do not guarantee uniqueness of "real" key values across multiple instances of DbContext. E.g. you can save a customer with a CustomerId = 1 even if one already exists in the database
- Disconnected scenarios (for example, using Attach) do not populate the surrogate key in shadow state, and therefore it wouldn't be possible to update or delete an existing entity without additional roundrips
@smitpatel and I discussed briefly that a design that creates the value for id deterministically based on actual values on properties could address this, but such design may have other problems.
Note that if we want entity hierarchies to share key space, we should use the discriminator value of the base type when we construct the id.
I haven't fully tested that this is an issue but I wanted to capture it before I forget:
@smitpatel and I discussed briefly that a design that creates the value for
iddeterministically based on actual values on properties could address this, but such design may have other problems.Note that if we want entity hierarchies to share key space, we should use the discriminator value of the base type when we construct the
id.