I created a project from template which included EF 6.0.
I then updated the nuget packages and EF 6.1.1 is installed.
However in web.config i still have this:
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
All other dependent assemblies are updated correctly (i.e MVC e.t.c)
Should i have updated this myself?
That is the assembly version, and it stays at 6.0.0.0
Related
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
<!-- For more information on Entity Framework configuration, visit
<sectionGroup name="dotNetOpenAuth" type="DotNetOpenAuth.Configuration.DotNetOpenAuthSection, DotNetOpenAuth.Core">
Hi i am getting the above error when i tried to run my project in MVC4.
Please let me know what should i do resolve this error.
I think the below suggestion would work (highlighted with **). Please let me know the result.
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=**6.0.0.0**, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
I'm trying to get Entity Framework working with and Oracle database.
I originally had entity framework 6 installed but now I've downgraded to EF 5 because I've read EF6 doesn't work with ODP.NET.
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
</configSections>
This is my app config, config section. I've reinstalled EF 5 on all my projects but keep getting this error.
I get this error :
Config Error There is a duplicate 'entityFramework' section defined
Config File \\?\D:\koopaproject\koopaproject\web.config
9: <!--For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468-->
10: <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />11: </configSections>
In my web.config:
<configSections>
<!--For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468-->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
</configSections>
<connectionStrings>
<add name="koopaco.com_koopaContext" connectionString="Data Source=localhost;Initial Catalog=koopaco.com_koopa;Persist Security Info=True;User ID=koopaco.com_zohre;Password=136613;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />
</connectionStrings>
And I installed :
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
</assemblyBinding>
But I still get this error.
I just had the same problem. The cause of my issue is that whilst I was running the application via IIS (as an application under the Default Web Site), there was a Web.config in the root that also had the <entityFramework> section defined.
Removed the Web.config from the root, and problem was solved.
Add this to web.config file
<entityFramework xdt:Transform="RemoveAll" />
If you have this problem while testing in IIS Express, look for a conflict in the higher-level "web.config" used by IIS Express. I found that I had a problem in C:\Users\yourUserIDHere\Documents\IISExpress\config**applicationhost.config**.
applicationhost.config is a sort of higher-level web.config for IIS Express.
My site was defined in there with a left over folder location on my C: drive where I had run an older copy of my project in the past.
Add this to web.release.config file
<entityFramework xdt:Transform="RemoveAll" />
so that when you deploy the web application entityFramework will not be on the web app's config file
I am trying to follow the video tutorial on http://msdn.microsoft.com/en-us/data/jj193542 using Visual Studio 2012 Express for Desktop.
I created POCO's, and a DbContext, ran some sample queries and it worked. But I did not provide any connection string. So where is the database? (sdf or mdf file maybe?)
During the tutorial the guy uses SQL Server Object Explorer to view the database, but I couldn't find that view in VS Express.
For reference, here is the default App.config that gets generated.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
</entityFramework>
</configuration>
"If SQL Express is installed (included in Visual Studio 2010) then the database is created on your local SQL Express instance (.\SQLEXPRESS). If SQL Express is not installed then Code First will try and use LocalDb ((localdb)\v11.0) - LocalDb is included with Visual Studio 2012"
For more information : http://msdn.microsoft.com/en-us/data/jj591621.aspx
#Default is correct, the default SQL server is (LocalDb)\mssqllocaldb in VS 2015 and 2017.
Have a class library and a WPF application and am trying to contain all the Entity Framework items within the class library and use an interface to get the info out. Everything is setup but I get this message each time I try it out:
Message "The type initializer for 'System.Data.Entity.Internal.AppConfig' threw an exception."
When I looked at the Inner Exceptions it appeared it couldn't find version 5.0.0.0 of EntityFramework and when I checked the Reference for it, it was 4.4.0.0. Tried uninstalling and reinstalling EntityFramework via NuGet but having no luck. Any ideas on what to try next?
App Config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
</entityFramework>
</configuration>
I think this is a problem with your app.Config prehaps you dont have the following:
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
</entityFramework>
This needs to be in the config file for your application entry point (whatever executable/webapp is running/using your class library)
A key detail to note is that EF4.4 is released inside the EF5 package and is used for non-.NET 4.5 applications (ie if you have .net 4.5 your reference will be 5.0 otherwise with .net 4 it will be 4.4)
Uninstalled EntityFramework
Updated Class Library to .Net Version 4.5
Reinstalled EntityFramework
Now all working.
I have tried changing the version of EF in the webconfig to the current installed version of the EF on the project and everything works smoothly.