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.
Update:
Part of the issue I have is that I have lots of methods like
IQueryable<Event> AddFlexibleFieldsFilter(
FlexibleFields flexibleFields,
IQueryable<Event> qry,
IQueryable<EventFlexibleField> fields
)
And using subclass or interfaces don’t play well with generic types (we are still on .net 3.5)