In Entity Framework - Is there any way to retrieve a newly created ID (identity) inside a transaction before calling \'SaveChanges\'?
I need the ID for a second inse
@zmbq is right, you can only get the id after calling save changes.
My suggestion is that you should NOT rely on the generated ID's of the database. The database should only a detail of your application, not an integral and unchangeable part.
If you can't get around that issue use a GUID as an identifier due it's uniqueness. MSSQL supports GUID as a native column type and it's fast (though not faster than INT.).
Cheers