How to include associative table information and still retain strong typing

Posted by mwright on Stack Overflow See other posts from Stack Overflow or by mwright
Published on 2010-04-06T21:59:52Z Indexed on 2010/04/06 22:03 UTC
Read the original article Hit count: 356

I am using LINQ to SQL to create strongly typed objects in my project.

Let's say I have an object that is represented by a database table. This object has a "Current State" that is kept in an associative table.

I would like to make a single db call where I pull back the two tables joined but am unsure how I should be populating that information into some sort of object to preserve strong typing within my model so that the view using the information can just consume the information from the objects. I looked into creating a view model for this but it doesn't seem to quite fit.

Am I thinking about this in the wrong way? What information can I include to help clarify my problem?

Other details that may or may not be important: It's an MVC project....

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about linq-to-sql