Application can't scaffold items

后端 未结 29 1048
自闭症患者
自闭症患者 2020-11-30 01:57

I created an MVC 5 application in VS 2013 Professional and then used EF 6.1 code first with an existing DB on SQL Server Express. When I try to create the views I’m using th

相关标签:
29条回答
  • 2020-11-30 02:19

    My solution was as simple as changing back the connection string name in my Web Config to DefaultConnection. Even though my dbContext has another name!

    Took me 2 hours to find out this nonsense!

    0 讨论(0)
  • 2020-11-30 02:19

    EF 6.1 does not Support scaffolding template use EF 5 Chares

    0 讨论(0)
  • 2020-11-30 02:20

    For some reason when I comment the oracle.manageddataaccess.client section out between <configSections> in web.config, it worked. (VS 2015 and ODT 12)

    <configSections>   
        <section name="entityFramework" type" />
        <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
        <!--<section name="oracle.manageddataaccess.client" />-->
    </configSections>
    
    0 讨论(0)
  • 2020-11-30 02:21

    I had faced the same problem while creating controller using scaffold with 'ASP.NET MVC5 using views with Entity Framework'

    The problem was because I provided <connectionStrings> tag before <configSections> in web.config. setting <connectionStrings> after <configSections> resolved the issue.

    I guess, while scaffolding, ASP.NET MVC want to resolve the Entity Framework first, then the connection string, as I have provided connection string earlier so that after resolving the Entity Framework version it could not find the connection string so it thrown invocation problem.

    0 讨论(0)
  • 2020-11-30 02:23

    I had the same error message. I tried adding a new Data context class from the Add Controller dialog, and then I got a different error:

    There was an error running the selected code generator:
    'Sections must only appear once per config file. See the help topic
    <locations> for exceptions.
    

    It turns out that I had two <connectionStrings> elements in my web.config file. (I had pasted one from the app.config of the class library that contained my Entity Framework model.)

    0 讨论(0)
  • 2020-11-30 02:25

    In my case, I had to revert my DBContext constructor to just using a static connection string, as defined in web.config

    Scaffolding did not work when I used a dynamically created connection string.

    public MyContext() : base("name=MyContext") { }
    
    0 讨论(0)
提交回复
热议问题