Earlier I asked a question about "Entity Framework and layer seperation" and found out that some people use a ViewModel to show their data in the UI.
For example if we got a "Person" table and an "Address" table and I want to show a combination of the two tables. I would then create a ViewModel, lets call it PersonAddress, and show it on the UI.
I have a few questions regarding this:
- How do you best save the "PersonAddress" object to the database since it does not exist in my EF context?
- If I only wanted to show the "Person" object, would I still create an identical "ViewModel" object to the one EF creates for me (without the EF specific properties ofcourse)
- Do people use the "EntityState" property and dosent it become useless if you only interact with the "ViewModel"?