I am using the Entity Framework Core to interface my SQLite database. I want to set a minimum and maximum range for the field ExitSide
in my model Station
:
using System.ComponentModel.DataAnnotations;
...
class Station
{
public int StationId { get; set; }
[Range(0,2)]
public int ExitSide { get; set; }
}
But somehow it seems to get ignored. I am still able to create Stations
with ExitSide=5
for example. What am I doing wrong?
EF Core当前无法识别范围数据注释
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.