How to keep related entities on object when returned from ASP.NET MVC view?

Because the productToEdit is a new product object populated from the form fields and if you don't have fields for the user how would you populate the User entity For a "workaround", first get the product from the db, edit this with the edited fields in the productToEdit and save to db.

I thought this was the case of the object "being new" coming from the view. I don't need to change the user in my scenario. The user is only in the relation to track who created the product.

Thanks for this info, I will work around it. – jesperlind Mar 8 '09 at 19:29.

You can also choose to use a custom ModelBinder that understands your model & persistence strategy to fully load the graph back into memory.

Thanks that sounds promising, I'll look into that. I solved the above by problem attaching the original object in the Edit-function in the service. In this way it passes the same validation I got when I create a Product.(Product must have User) – jesperlind Mar 10 '09 at 8:32.

Entity framework - How to keep related entities on object when returned from ASP.NET MVC view - Stack Overflow.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions