So here is my issue. I am trying to move our codebase to use Entity Framework core 2.0, However, one of the entity types we are using is a Dictionary. I need to map some of it's keys to DB Columns.
So far, it might be annoying, but not to hard, right? Just use a wrapper where the exposed properties are just using the dictionary, right?
Well, here comes the fun part: We also have modules - Those are pieces of code, that I only know which to use during run-time, and they can each add key/values to this dictionary, which also going to need to be saved as columns to the DB.
If there was a linear hierarchy here, I'd have used extension by inheritance, but, that is not an option, as each module can extend the dictionary independently.
So... Now I need to find a way to map this dictionary, where I don't know during compilation time what keys it will have, to a DB table.
I thought about using Reflection.Emit to create the wrapper class dynamically, but that seems extremely complex and cumbersome.
So... Any ideas how can I do that? Thanks
Aucun commentaire:
Enregistrer un commentaire