Suppose I have a thousand classes that all inherit one base class, and each of these classes (not the base) has a table, each of which has the same required columns. How can I use reflection or generics to add or update a row in the correct table? I'll know the name of the specific entity at runtime.
There are a handful of stackoverflow posts about getting a dbset with reflection, but the answer results in an IQueryable, which you cannot add a new item to. Those posters seem content with that because they're just fetching data I suppose. I need a DbSet so I can add and update. I can get the fully qualified entity name and type, but how do I get a DbSet with that? I don't want to write a 1000 line switch statement :(