Error trying to register in C #

0

I'm creating a program and I need the user to register to log in to it. When running the program, when I try to make a registration this error appears in Visual Studio: "The model backing the 'Bank' context has changed since the database was created." This error points to this part of the code in the first line (User ...):

public bool Login(String login, String senha)
    {
        Usuario usuario = this.banco.Usuarios.Where(user => user.Email.Equals(login) && user.Senha.Equals(senha)).FirstOrDefault();

        Gerenciador.usuarioLogado = usuario;

        return (usuario != null);
    }

Here is the beginning of the code:

public class Gerenciador
{

    public static Usuario usuarioLogado;

    private Banco banco = new Banco();
 (...)

Please help me. I need to submit this program this week and can not log in to the program: x

Thank you in advance!

    
asked by anonymous 23.06.2018 / 15:40

1 answer

0

Try adding to your class the context of the database application this code snippet:

protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
     Database.SetInitializer<NomeDoSeuContexto>(null);
     base.OnModelCreating(modelBuilder);
}
    
23.06.2018 / 21:42