tags:

views:

11

answers:

2

I have a view that is a composition form several sources (for read only), so none of the keys are unique. Can I create a key to use in Linq-to-sql, or should I just create an composite column in my view that is a concatenation of all the keys.

A: 

You don't have to, if you don't want to. Linq to SQL only requires primary keys when you want to update or insert data, and I guess you don't want to in a view.

You can use a simple where statement with all your keys in it to select rows:

from item in dc.SomeView
where item.Key1 = 500 && item.Key2 == "abc" && item.Key3 == 16
select item
AHM
Ahh, yes it is because I am using a Domain Service that is causing my issues. It requires that you have a primary key defined
Grayson Mitchell