Error Adding Controller with views using Entity Framework in Asp.NET

0

When you try to add the following error appears:

Model:

usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Web;namespaceMVCEntity.Models{publicclassUsuario{publicintId{get;set;}publicStringLogin{get;set;}publicStringSenha{get;set;}}}

FileDatewhereImaketheDBsettings:

usingSystem.Web;usingMVCEntity.Models;usingSystem.Data.Entity;usingSystem.Data.Entity.ModelConfiguration.Conventions;namespaceMVCEntity.Data{publicclassTestandoMVCContext:DbContext{publicTestandoMVCContext():base("TestandoMVC_Desenv")
        {

        }

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

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

            base.OnModelCreating(modelBuilder);
        }
    }
}

Lines added in my Web.config:

  <connectionString>
    <add name="TestandoMVC_Desenv" connectionString="Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=E:\Projetos\asp\MVCEntity\MVCEntity\App_Data\TestandoMVC_DB.mdf;Integrated Security=True" providerName="System.Data.SqlClient"/>
  </connectionString>
  <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
  <system.data>
    <DbProviderFactories>
      <add name="SqlClient Data Provider"
       invariant="System.Data.SqlClient"
       description=".Net Framework Data Provider for SqlServer"
       type="System.Data.SqlClient.SqlClientFactory, System.Data,   
      Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
    </DbProviderFactories>
  </system.data>

HELP !!!

    
asked by anonymous 16.04.2018 / 23:45

1 answer

0

Good for everything it seems! After hours of searching, this was nothing but the lack of an "s" in the <connectionString> tag that would be <connectionStrings>

Lack of attention from me!

In my case, however, searching in other forums and even in stackoverflow (EN) there are several other types of problems that can cause the same!

Follow the link for other types of solutions: link

    
17.04.2018 / 00:25