Aiyoh
EF attributes vs built-in C# keywords (like required). Differences and when to use?
Essentially what the title says. In this code
I'm not sure whether I need to add a [Required] tag to the Id or if [Key] makes that redundant, or if I need to make Id required with the c# keyword. I've researched this and what I've found is that the required keyword is checked at compile time while the attributes from EF are checked during runtime and they're what's being used for validation etc.
The obvious question I have is to always use required attribute where I use the keyword in c#, or vice versa?
Another example here is that my Role will always be defined. I have the [Required] attribute for validation. But do I need to add the required modifier as well?
221 replies
dbContext.Remove removes from application, but in database it remains
I click the delete button, it gets removed from the program. I check in sqlite db browser and the record is still there? This persists through rebuilds and reruns, in the program it doesn't show, in the db browser it does. This is a WinForms project btw
111 replies