Using Entity Framework, how do I specify a sort on a navagation property?
Posted
by Jared
on Stack Overflow
See other posts from Stack Overflow
or by Jared
Published on 2010-04-21T02:20:50Z
Indexed on
2010/04/21
2:23 UTC
Read the original article
Hit count: 292
I have two tables: [Category], [Item]. They are connected by a join table: [CategoryAndItem]. It has two primary key fields: [CategoryKey], [ItemKey]. Foreign keys exist appropriately and Entity has no problem pulling this in and creating the correct navigation properties that connect the entity objects.
Basically each category can have multiple items, and items can be in multiple categories. The problem is that the order of items is specified per category, so that a particular item might be third in one category but fifth in another.
In the past, I have added a [Sequence] field to the join table and modified the stored procedure to handle it. But since Entity is replacing my stored procedures, I need to figure out how to make Entity handle the sequence.
Any suggestions?
© Stack Overflow or respective owner