我在 MVC 中使用代码优先方法来生成表。我试图使我的 Employee 类的主键成为 uint 以防止负值,但显然,我总是遇到异常。是否有用于 int 类型的装饰代码以防止负数或允许 uint 作为主键的解决方法?public class Employee{ [Key] [Column(Order = 0)] public uint EmployeeId { get; set; } public string FirstName { get; set; } public string LastName { get; set; } public decimal Salary { get; set; }}
添加回答
举报
0/150
提交
取消