Dave Mackey
Dave Mackey

Reputation: 4432

Dynamic Data Associate Related Table Value?

I have create a LINQ-to-SQL project in Visual Studio 2010 using Dynamic Data. In this project I have two tables. One is called phones_extension and the other phones_ten. The list of columns in phones_extension looks like this: id, extension, prefix, did_flag, len, ten_id, restriction_class_id, sfc_id, name_display, building_id, floor, room, phone_id, department_id In phones_ten it looks like this: id, name, pbxid Now, I'd like to be able to somehow make it so that there is an association (or inheritance?) that essentially results in me being able to make a query like phones_extension.ten and it gives me the result of phones_ten.name. Right now I have to get phones_extension.ten_id and then match that against phones_ten.id - I'm trying to get the DBML to handle this translation automatically. Is this possible?

Upvotes: 0

Views: 96

Answers (1)

Wizzard
Wizzard

Reputation: 944

OK Dave, you need to setup a relatioship in the DB for this to work in Linq to SQL you could just create the relatioship (association in L2S) but there will need to be a primary key on each table anyway to allows edits.

Upvotes: 1

Related Questions