With ADO.NET and stored procedures, it's simple to return Scope_Identity() as an output parameter from SQL Server so that you can immediate perform a get and get the same row/object you just inserted. I'm a little confused on how to properly achieve this with EF?
I'm using MVC4, EF5 (Code first/Fluent API), and a Repository Pattern in a Service Layer for CRUD and business logic so that the Controller doesn't have to deal with EF any data access. An Action in my controller passes a ViewModel to the service layer for insert, but naturally has no ID yet. The Service Layer converts the view model to a Domain Entity model and inserts it. Now I want to return the same view model back to my view, but how can I be sure it's the same object without an ID? Seems like there should be an obvious solution without having to resort to timedatestamps or guids.
Sorry if this is basic but I haven't been able to find an answer to this.