How do I switch the table that is queried with linq-to-sql
- by Ian Ringrose
We have two tables with the same set of columns; depending on the “type” of object the value is stored in one of the two tables. I wish to use common code to access these two tables.
If I was using “raw sql” I could just use String.Format() to change the table name.
(Likewise for updates etc)
The two separate tables are needed as the data access patterns are very different for the common queries on the two tables and therefore different indexes are needed. “Views” and “instead of triggers” etc to make the tables look like a single table are not liked here. A lot of our customers use low end version of SqlServer so we cannot use partition tables.