[英]The best way to keep Tasks' Priority (ASP.NET MVC)
There is class Task.cs 有一个类Task.cs
public class Task
{
[Required]
public int Id { get; set; }
[Required]
public string Title { get; set; }
public string Description { get; set; }
public int Priority { get; set; }
[Required]
public string DateCreation { get; set; }
public string DateTarget { get; set; }
public bool IsActive { get; set; }
public bool IsDeleted { get; set; }
}
and its property Priority
can have 4 different values: 0 - low, 1 - normal, 2 - high, 3 - extreme. 及其属性Priority
可以有4个不同的值:0-低,1-正常,2-高,3-极端。 What is the best way to keep these values? 保持这些价值的最佳方法是什么? Should I create class Priority
, or just create table Priority
in my database and set these values in or use List
maybe? 我应该创建class Priority
还是仅在数据库中创建表Priority
并在其中设置这些值或使用List
?
It's my first attempt to create Asp.Net MVC application so I'm not sure what way is better. 这是我第一次创建Asp.Net MVC应用程序的尝试,因此我不确定哪种方法更好。
正如Stephen Muecke所说的那样,您需要使用枚举。您可以在可从另一个层(UI,DAL,Service)访问的层中创建枚举。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.