G
Guest
Hi,
I have a table with the data like this,
ID Status Description
1 R Read
2 U UnRead
D D Deleted
I want to load this data in a class (say named Status) which I want to use
through out my project and should be able to access it like,
Status.Read or
Status.UnRead or
Status.Deleted
with each returning their corresponding values as in the database table
shown above.
To sum it up I want to create an enum with values loaded from database. I
think it may be possible using Reflection or Custom Attributes but don't know
how to do it.
One more thing is if I use reflection than I guess I won't be able to use
Status.Read in design time which means no use of it, correct me if I am wrong.
Any ideas how to go about it?
Regards,
Waqas Pitafi
I have a table with the data like this,
ID Status Description
1 R Read
2 U UnRead
D D Deleted
I want to load this data in a class (say named Status) which I want to use
through out my project and should be able to access it like,
Status.Read or
Status.UnRead or
Status.Deleted
with each returning their corresponding values as in the database table
shown above.
To sum it up I want to create an enum with values loaded from database. I
think it may be possible using Reflection or Custom Attributes but don't know
how to do it.
One more thing is if I use reflection than I guess I won't be able to use
Status.Read in design time which means no use of it, correct me if I am wrong.
Any ideas how to go about it?
Regards,
Waqas Pitafi