Unable to retrieve metadata for - Error creating Controller

0

I created a web project with MVC and entity framework 4.5, and MYSQL database.

I added the MySql.Data MySql.Data.Entity and MySql.web

I made all the settings as images below

IfollowedthewalkthroughandmyBankwasaddedaspicturebelow:

IcreatedmyentitybynameCustomer.Hereisthecode:

namespaceMysqlConnectorMVC.Models{publicclassCliente{publicintId{get;set;}publicstringNome{get;set;}publicstringObservacao{get;set;}publicintIdade{get;set;}publicstringEmail{get;set;}publicstringLogin{get;set;}publicstringSenha{get;set;}publicstringConfirmarSenha{get;set;}}}

Ialsocreatedmycontextclass:

namespaceMysqlConnectorMVC.Data{publicclassContext:DbContext{publicContext():base("name=restauranteEntities")
    {

    }

    public DbSet<Cliente> Cliente { get; set; }

    protected override void OnModelCreating(DbModelBuilder modelBuilder)
    {
        modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
        base.OnModelCreating(modelBuilder);
    }
  }
}

My Connection String is below:

 <connectionStrings>
<add name="DefaultConnection" providerName="System.Data.SqlClient" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=aspnet-MysqlConnectorMVC-20171012215253;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnet-MysqlConnectorMVC-20171012215253.mdf" />
<add name="restauranteEntities" connectionString="metadata=res://*/ClienteModel.csdl|res://*/ClienteModel.ssdl|res://*/ClienteModel.msl;provider=MySql.Data.MySqlClient;provider connection string=&quot;server=localhost;user id=root;password=toor;persistsecurityinfo=True;database=restaurante&quot;" providerName="System.Data.EntityClient" />

But when trying to create my Controller from my entity and my context as below:

Igetthefollowingerror:

I've tried the solution to this error, even here in the stack, but I could not solve it.

My question is: How to solve this error? What am I doing wrong?

    
asked by anonymous 13.10.2017 / 04:06

1 answer

0

I know it's been a long time but here I had the same problem so I left the "Data Context class" part blank and worked normally. here a link from a person who did the same thing

link

    
22.08.2018 / 15:26