0

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;
2
  • If you've duplicated the same structure multiple times in your database... you've probably got a basic design problem. Why not refactor al those "Same Table Structures" into a single table structure & differentiate between the data they contain using a TypeId. Commented Jun 1, 2012 at 10:31
  • I can't do that because one reference can be for details and other for users. It's not good experience to sore them together. Commented Jun 1, 2012 at 10:44

2 Answers 2

1

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

Sign up to request clarification or add additional context in comments.

Comments

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.