I'll give you an example
I have two tables
CLOSING
CierreID
Descripcion
Entity
EntidadID
CierreID
Descripcion
At the code level I create a Closure object
Cierre a = new Cierre()
a.Descripcion = "Ejemplo"
db.Cierres.Add(a);
Now I want to assign this closure id to the entity that has not yet been saved in the database without doing a savechanges before.
Is there any way??
Greetings.
I do it this way.
1:
2: I use this method to add and return the Inserted Id
Controller
I hope it works for you
Solution:
Entity detects it by itself.
I hope it works for you.
Greetings.