0
Migration is generating the name field in the table as nullable:true i don’t want it to be true, as I do to solve this problem?
public class Professor
{
public string Id { get; set; }
public string Nome { get; set; }
public string Sobrenome { get; set; }
public IList<ProfessorTurma> Turmas { get; set; }
public Professor(string nome, string sobrenome)
{
Nome = nome;
Sobrenome = sobrenome;
//Turmas = new List<Turma>();
}
public bool ValidaProfessor()
{
if(string.IsNullOrEmpty(Nome) || string.IsNullOrEmpty(Sobrenome)
|| Nome.Any(x => char.IsDigit(x)) || Sobrenome.Any(x => char.IsDigit(x))
)
{
return false;
}
else
{
return true;
}
}
}
public partial class TurmaUsuarioProfessorProfessorTurma : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Professores",
columns: table => new
{
Id = table.Column<string>(nullable: false),
Nome = table.Column<string>(nullable: true),
Sobrenome = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Professores", x => x.Id);
});
Understood perfectly and put into use, thanks for the help!
– Robson Junior
@Robsonjunior if the answer answered you, you can accept it
– Jeferson Almeida