views:

380

answers:

1

Our team is currently working on a large project which makes heavy use of foreign key tables as they are used on our TeamMember Management Webapp.

Basically, one TeamMember can be in a Team, in an Area and a TeamArea (the latter for editing and rights management).

My main goal is focused on retrieving the data for showing these FK Fields as real DropDownLists with values behind instead of TextBoxes with the FK_ID number in my edit/create view.

What I have tried so far:

  • Create a FormViewModel which would store all other data a lists. Conclution: Not usable as I would need to pass / create another instance of my repository.

  • Directly implement those lists on the TeamMember Class - but that didn't really work out well.

  • Also thought about harcoding it in the repository but couldn't really get the data out correctly from the tables.

What would be the best and "cleanest" approach to accomplish that?

+1  A: 

Your first option is the best, I'm not sure why you would dismiss it so easily. What's wrong with passing or creating another instance of your repository? That shouldn't really do much more than initialize your provider.

The normal pattern is for your models to get data from a repository, so it seems to me that you should revisit this.

womp