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
asp.net-mvc-3 entity-framework composite-primary-key


source to share


No one has answered this question yet

See similar questions:

2
How to use ASP.NET MVC4 / EF5 scaffolding with composite primary key?

or similar:

783
Entity Framework vs LINQ to SQL
758
Entity Framework 5 Record Update
630
Fastest way to insert into Entity framework
595
First Code - Model / Database First
547
Sqlite primary key for multiple columns
297
What are the best practices for using a GUID as a primary key, especially when it comes to performance?
54
ASP.NET adds "complex primary key" migration how to use fluent API
2
How to use ASP.NET MVC4 / EF5 scaffolding with composite primary key?
1
Save entity in Entity Framework without primary key
1
How to use string as primary key in MVC 3 Entity Framework 4.1 Code First?



All Articles
Loading...
X
Show
Funny
Dev
Pics