I have two tables, Users and TempUsers and I need to do operations on both of them. I already have my users type defined and I want to add it to the DbContext for both tables. P
That is not possible. EF cannot map same class twice within same context. Your single User
class can be only mapped to Users
table or TempUsers
table in single context type. You need either two user classes or two different context types (with different mapping configuration) - one providing access to Users
table and second providing access to TempUsers
table.
This reminds me of my own question: Querying data using Entity Framework from dynamically created table
Actually, you can use EF and ExecuteStoreQuery
to retreive objects, but you cannot use the LINQ features of EF.