Given an sqlite database, and a code first approach, how can I add a check constraint to a table?
I can't use sql, so is there an attribute or so I can use, like [PrimaryKey]
?
I'm hoping for something like
public class XXX
{
[PrimaryKey, Check(()=>Id==1)]
public int Id {get;set;}
}
In fact, what I really want, is to constrain the table so that it can contain at most one row. If there's any other way do achieve this, I'd be happy too.
Is there any way to do this?
Lots of Greetings!
Volker