I have a database table that essentially contains different types of things. I will use animals as an example. I have a table called AnimalTypes:
AnimalTypes { ID:int, Name:string }
Then I fill it as follows:
1:Dog, 2:Cat, 3:Fish
I would like for you to have some kind of C # object that functions like this listing should be fully read from the database:
enum AnimalTypes { Dog = 1, Cat = 2, Fish = 3 }
Is there a way to create an enum / class from a database table as described? I basically want to be able to reference things in the AnimalTypes table using intellisense and AnimalTypes.Dog as an example; I really don't need an enumeration, just something like such functions. Is it possible?
Edit: I'm not really worried about creating a DLL, as I saw in other related issues. I feel this should be possible with reflection.
Suppose I do not need intellisense.
source share