Entity Framework and MVC Scaffolding with Composite Primary Keys

I am wondering how Entity Framework and MVC forests handle primary keys. When I create a controller in an MVC3 project and select the Controller with Actions and Read / Write Views using Entity Framework forest template and point to my model, a controller is generated that uses a single primary key.

My entity has 2 keys that are required for correct data transfer. I made the necessary tweaks manually, but I wanted to make sure I got it right before moving forward.

My thinking is that when Microsoft implemented this pattern, they believed that supporting a single primary key would be the most likely scenario, so they don't support composite key. It's right? If not, how can I create a forest template to create controllers that look for both pieces of data?

+3


source to share





All Articles