views:

57

answers:

0

Hi,

I'm implementing the repository pattern found here Implementing Repository Pattern With Entity Framework

One of the methods he has is SelectByKey. In the comment called Key field impementation by [email protected], there was a suggestion to make it a little more generic of an implementation:

I would like to add a simple mechanism to identify the Key field of an entity type when it's name is not ID in the generic repository implementation to make it a little more generic:

First he lists the actual implementation, then he lists the implementation he suggests. Please read the comment for details on his implementation.

Can anyone tell me how exactly this works -- How would a method in my service layer call SelectByKey?