The software I will be building will involve "application" switching between different status a lot. Certain tasks can be done depends on the status an application is at. I was thinking about using enum as the status
public class Application
{
public int Id {get;set;}
public Status {get;set;}
}
public enum Status
{
[Description("New")]New = 1, [Description("Closed")]Closed = 2
}
But then I thought maybe it’s good to use lookup table in the database as status does get updated/re-ordered quite often
table status (id int pk, desc string, sort_order int)
table application (id int pk, status_id int fk)
In my case I need to do things like
if (application.Status == Status.New)
{ //do something }
else if (application.Status == Status.Closed)
{ //do other things }
I think the above case is easier to do with enum. However when it comes to updating status sort order or description it'll be quite hard.
Should I used reflection to dynamically create enum based on values from lookup table? Or should I use state pattern? The problem I see with enum relfection is performance impact. And state pattern can produce a lot of redundant code.
What do you think? Thanks in advance!