Hint to MVC view generator for primary key on POCOs
Posted
by myotherme
on Stack Overflow
See other posts from Stack Overflow
or by myotherme
Published on 2010-04-19T09:54:09Z
Indexed on
2010/04/20
23:03 UTC
Read the original article
Hit count: 182
asp.net-mvc
When generating a strongly-typed Index view for my model I always get the following:
<%= Html.ActionLink("Edit", "Edit", new { /* id=item.PrimaryKey */ }) %>
I am using a POCO class for use with our ORM. As I understand it when using LINQ to SQL the view code will know which field is the primary key.
Is there a way that I can an attribute to the property (or class) that will let the View Generator know that the ID property if the primary key?
© Stack Overflow or respective owner