Pre-create views for EF code.

Finally turning around to live on a new site built with Entity Framework Code First and MySql, one annoying annoyance is the pause that often occurs when metadata is viewed. This seems to happen much more frequently than the application pool gets recycled. (?)

My guess is that for a site that has a steady stream of traffic, this is often overlooked. For a new site with infrequent traffic, it seems like every time I visit the site, there is a 4-5 second delay when rendering the first page.

So, I looked at the following links:

http://msdn.microsoft.com/en-us/library/bb896240.aspx

http://visualstudiogallery.msdn.microsoft.com/72a60b14-1581-4b9b-89f2-846072eff19d

EF Power Tools CTP1 looked promising, except that it appears to have been broken for EF 4.3 and hasn't been updated for several months. Also I'm not sure how this tool will fit into our automated build process.

The OptimizeContext () or WriteEdmx () ​​methods that EF Power Tools uses are exploiting this error

System.Reflection.TargetInvocationException: 
Exception has been thrown by the target of an invocation. --->    System.Data.ProviderIncompatibleException: The provider did not return a ProviderManifestToken string. ---> System.Data.SqlClient.SqlException: 
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

      

It was originally suggested that it might be MySql related, but several others in the EF Power Tools Q&A section are reporting this.

So, in a nutshell, as I first pre-create views for EF 4.3 code, is it preferable this way in order to have an automated build process?

+3


source to share


2 answers


Paul answered my question:

Entity framework initialization - SLOW - what can I do to get it up and running faster?

by creating T4 templates:

http://blog.3d-logic.com/2012/05/28/entity-framework-code-first-and-pre-generated-views/

which are also not perfect, but more useful than anything else I've seen.



Then you can do something like:

http://www.platinumbay.com/blogs/dotneticated/archive/2009/08/28/running-t4-templates-with-msbuild.aspx

to add it to the build process, but it's slow, so you can just leave it as a (overnight) manual step when updating the EF model.

Indeed they need a warning that says DO NOT USE EF WITH> 500 TABLES, it gets more and more annoying to use.

+1


source


I faced this same error when I run VS2010, EF v4.3.1 and Entity Framework Power Tools Beta 2. The solution for me was to run Visual Studio as administrator. (This is done by right-clicking the icon and selecting "Run as Administrator" from the context menu.) At this point, I was able to use the Generate Views option in EFPT.



0


source







All Articles