Using Data Annotations for SQLite in Entity Framework Core

c# entity-framework-core sqlite

Question

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?

1
0
2/22/2018 5:33:02 PM

Accepted Answer

EF Core does not currently recognise the Range data annotation

0
2/22/2018 6:37:09 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow