Ars
Ars

Reputation: 193

Dynamic Table in LINQ to SQL query

I have several references in DB with same table structure. I don't want to write several LINQ queries to each db. Is it possible to develop one query with dynamic Table parameter? My query example:

var query =
            from myTranslations in myContext.translations
            where myTranslations.code == strLabelCode
            select myTranslations;

Upvotes: 0

Views: 300

Answers (2)

rt2800
rt2800

Reputation: 3045

Use datacontext GetTable() method to vary table type as listed here MSDN

Upvotes: 0

TomTom
TomTom

Reputation: 62157

No, sorry. Simple like that - only via for example reflection, which makes it - ah - hard er than having multiple table objects.

Upvotes: 1

Related Questions