I'm new to Blazor and EF Core and I'm learning about the mapping between C# classes and the database tables created by EF Core.
While defining a class in C#, Intellisense will complain if I define a string property as not nullable as "it must contain a non-nullable value when existing constructor". So there are 2 options here and I would like you to explain to me the implications/differences of each alternative.
- Mark the property as non-nullable and initialize it to an empty string.
- Mark the property as [Required]
Another thing that I noticed is that marking the property as [Required] doesn't remove the warning, even though the property will need to have a value when creating the object?