Reputation: 3593
I have an Entity called "MyEntity".
Now, In my database, every month a new table is created called "MyEntityJan2017", the following month will be "MyEntityFeb2017" etc...
Normally I return my entities like this:
public DbSet<MyEntity> MyEntity{ get; set; }
But I can't do this here as there is no such class as "MyEntityJan2017"
The repository methods for these tables use the returned DbSet and query them using Linq.
How do I return a DbSet for dynamically created tables?
The only solution I have so far is to query these tables the old fashioned way as below but I'd rather not.
var resultSet = dataContext.Database.SqlQuery<MyEntity>(sqlQuery, paramList);
Upvotes: 0
Views: 513