How to use StoreGeneratedPattern in the most effective manner is what interests me.
I used to let the database produce my ID in the past, but I was curious whether there are any benefits to setting
StoreGeneratedPattern = None
in place of
StoreGeneratedPattern = Identity
Even when I set it to Calculated, I'm not sure what occurs.
Have any suggestions? Is there a decent article on this anywhere since MSDN doesn't really explain it. In my schema, I generally use ints and a few GUIDs.
Verify my blog entry about
It clarifies some variations between
The appropriate response for ID (PK) is
if the program assigns an ID or
if ID in DB is assigned.
option is "invalid" since ID is not the case here; instead, this option is utilized when value is modified throughout each entity's persistence (including during updates).
The distinction between
is the action of the SQL command. if a property
After Insert, EF will choose the value and send it back to your application. if a property
After Insert and Update, EF will choose the value and return it to your application.
is unrelated to database identity. You may establish ID using a different technique (such as the default value for a guid or trigger) and you don't even need to store identity in the database, but you still need
in order to provide value to your application.
when you start utilizing
Every Insert or Update will always be followed by a Select for columns created by the database. Without it, it cannot function. Since these commands only need one roundtrip to the database, the performance effect is minimal.