Reputation: 3498
Every time I need to update my emdx from database, the update wizard takes an incredible amount of time to do so rendering itself as not responding once you hit the finish (as finish the update) button.
I use Visual Studio 2015 and LocalDb SQL Server 2014. Some people suggested to install the Service Pack 1 to address the issue. I have installed the SP1 for LocalDb, but it has not helped. My installation of VS2015 is also rather new.
I have the latest Entity Framework 6 version (from nuget).
Upvotes: 42
Views: 21293
Reputation: 359
This kind of problem usually happen because the server running SQL server it self is not in good condition. Maybe the disk space or memory on the server is getting too low to finish the task.
Check the server that running your DB.
Upvotes: -1
Reputation: 2636
.edmx.diagram
file with the EDMX Diagram Boilerplate below.edmx
file with the EDMX Runtime Boilerplate below<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="3.0" xmlns:edmx="http://schemas.microsoft.com/ado/2009/11/edmx">
<!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
<edmx:Designer xmlns="http://schemas.microsoft.com/ado/2009/11/edmx">
<!-- Diagram content (shape and connector positions) -->
<edmx:Diagrams>
<Diagram DiagramId="820459acb0f543cfaf7db8643f38c2d6" Name="Diagram1" ZoomLevel="85">
</Diagram>
</edmx:Diagrams>
</edmx:Designer>
</edmx:Edmx>
<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="3.0" xmlns:edmx="http://schemas.microsoft.com/ado/2009/11/edmx">
<!-- EF Runtime content -->
<edmx:Runtime>
<!-- SSDL content -->
<edmx:StorageModels>
<Schema Namespace="ShareDirectModel.Store" Provider="MySql.Data.MySqlClient" ProviderManifestToken="5.5" Alias="Self" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns:customannotation="http://schemas.microsoft.com/ado/2013/11/edm/customannotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm/ssdl">
<EntityContainer Name="ShareDirectModelStoreContainer">
</EntityContainer>
</Schema></edmx:StorageModels>
<!-- CSDL content -->
<edmx:ConceptualModels>
<Schema Namespace="ShareDirectModel" Alias="Self" annotation:UseStrongSpatialTypes="false" xmlns:annotation="http://schemas.microsoft.com/ado/2009/02/edm/annotation" xmlns:customannotation="http://schemas.microsoft.com/ado/2013/11/edm/customannotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm">
<EntityContainer Name="ShareDirectContext" annotation:LazyLoadingEnabled="true">
</EntityContainer>
</Schema>
</edmx:ConceptualModels>
<!-- C-S mapping content -->
<edmx:Mappings>
<Mapping Space="C-S" xmlns="http://schemas.microsoft.com/ado/2009/11/mapping/cs">
<EntityContainerMapping StorageEntityContainer="ShareDirectModelStoreContainer" CdmEntityContainer="ShareDirectContext">
</EntityContainerMapping>
</Mapping>
</edmx:Mappings>
</edmx:Runtime>
<!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
<Designer xmlns="http://schemas.microsoft.com/ado/2009/11/edmx">
<Connection>
<DesignerInfoPropertySet>
<DesignerProperty Name="MetadataArtifactProcessing" Value="EmbedInOutputAssembly" />
</DesignerInfoPropertySet>
</Connection>
<Options>
<DesignerInfoPropertySet>
<DesignerProperty Name="ValidateOnBuild" Value="true" />
<DesignerProperty Name="EnablePluralization" Value="true" />
<DesignerProperty Name="IncludeForeignKeysInModel" Value="true" />
<DesignerProperty Name="UseLegacyProvider" Value="false" />
<DesignerProperty Name="CodeGenerationStrategy" Value="None" />
<DesignerProperty Name="DDLGenerationTemplate" Value="$(VSEFTools)\DBGen\SSDLToMySQL.tt" />
</DesignerInfoPropertySet>
</Options>
<!-- Diagram content (shape and connector positions) -->
<Diagrams></Diagrams>
</Designer>
</edmx:Edmx>
Upvotes: 0
Reputation: 371
I still had to do this with Microsoft SQL Server 2014 (SP2-GDR) (KB4019093) - 12.0.5207.0 (X64) Jul 3 2017 02:25:44 Copyright (c) Microsoft Corporation Standard Edition (64-bit) on Windows NT 6.3 <X64> (Build 9600: ) (Hypervisor)
using Entity Framework 6.2.0. How in the world has this not yet been solved?!
Upvotes: 1
Reputation: 8273
Running the following on the DB worked for me:
ALTER DATABASE SCOPED CONFIGURATION SET LEGACY_CARDINALITY_ESTIMATION=ON
Then, after the update, setting it back using:
ALTER DATABASE SCOPED CONFIGURATION SET LEGACY_CARDINALITY_ESTIMATION=OFF
This is per this thread over at the EF6 repo on Github.
It should be noted that the following is also reported in that thread to work though I have not tested it because the former worked so well for me:
UPDATE STATISTICS sys.syscolpars
UPDATE STATISTICS sys.sysschobjs
UPDATE STATISTICS sys.syssingleobjrefs
UPDATE STATISTICS sys.sysiscols
They also punted this back to the SQL Server team and opened up this issue over at Microsoft Connect.
Upvotes: 22
Reputation: 630
Today, my coworkers and I left the wizard alone and let it update for ~10 minutes. While it took quite a while, it did complete. This is the best solution for us (for now), since we are unable to set the compatibility level of our DB without the proper permissions.
Upvotes: 3
Reputation: 3897
Changing SQL Server compatibility level or trace-flag 9481 is no option for me.
I gave EntityFramework Reverse POCO Generator a try.
https://visualstudiogallery.msdn.microsoft.com/ee4fcff9-0c4c-4179-afd9-7a2fb90f5838
It's a configurable generic T4 Template and works very well till now.
It even has an Option for the mentioned trace-flag
IncludeQueryTraceOn9481Flag = false; // If SqlServer 2014 appears frozen / take a long time when this file is saved, try setting this to true (you will also need elevated privileges).
Ironically it works fast even if the flag is off :) Seems like they are using different queries for metadata compared to the VS EF Designer.
Upvotes: 1
Reputation: 3498
Setting the compatibility level of the database to 110 has worked for me.
To check the compatibility level, run this script:
select compatibility_level from sys.databases where name = '<YOUR_DB_NAME>'
To set the compatibility level, use this script:
alter database <YOUR_DB_NAME> set compatibility_level = 110
Upvotes: 84