Simple way to use Foreign Key values for sorting?
Posted
by Brian Rizzo
on Stack Overflow
See other posts from Stack Overflow
or by Brian Rizzo
Published on 2010-05-14T01:09:05Z
Indexed on
2010/05/14
1:14 UTC
Read the original article
Hit count: 325
Disclaimer: I jumped to C# 2008 recently and SubSonic 3 (3.0.0.4) at the same time. I haven't used Linq for much of anything in the past.
Is there an easy way to use the foreign key display value for sorting, rather than the FK Id (which is numeric)?
I've added a new Find method in my ActiveRecord.tt to help with sorting based on a string field name but after doing some testing I realized that even though its working as it should be, I am not handling foreign key fields at all (they are just sorting by their value).
Even if I need to change how I am accessing the data it is early enough in the project to do that. Just looking for suggestions.
© Stack Overflow or respective owner