My team uses Db first design. We create the database, then create the model using the Scaffold-DbContext command.
The problem is when we need to modify the model and then do a recreation.
public partial class UserInfo
{
public int Id { get; set; }
[Required]
public string FirstName { get; set; }
public string LastName { get; set; }
public string UserName { get; set; }
public string Password { get; set; }
public DateTime RecordCreated { get; set; }
}
Upon invoking a Scaffold-DbContext with the -Force it will remove the [Required] from it.
Should I be looking at using a ViewModel, creating partial classes or what?
Very early on in using EF core 2.1 so any help would be greatly appreciated.
Joe