Nick
Nick

Reputation: 5882

Pre-Generating views to improve query performance in Entity Framework

I am trying to pre-generate view metadata for my Entity Framework project and have run across a problem on the last step when using this resource:

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

Everything else is compiling great, but I'm getting an error when I run my application, and I suspect it's due to a problem with the final step, 're-adding mapping and model files as embedded resources for ASP.NET projects.'

I'm receiving 'Unable to load the specified metadata resource.' and my connection string is as follows:

<add name="myEntities" 
connectionString="metadata=
.\DataStructure.csdl|
.\DataStructure.ssdl|
.\DataStructure.msl;provider=System.Data.SqlClient;provider 
connection string=&quot;Data Source=x;Initial Catalog=x;Persist Security Info=True;User ID=x;Password=x;MultipleActiveResultSets=True&quot;"  

providerName="System.Data.EntityClient" />

It is suggested in the document that my connection string file should include the following but haven't been able to get it right in any configuration:

Metadata=res://<assemblyFullName>/<resourceName>;


Metadata=res://*/<resourceName>;


Metadata=res://*;

Assuming my assembly name is DataStructure.EF, how should my string be constructed?

Upvotes: 0

Views: 1090

Answers (2)

Nick
Nick

Reputation: 5882

I compiled a full guide for anybody else having problems and published it here: http://kewney.com/posts/software-development/pre-generating-views-to-improve-query-performance-in-aspnet-mvc-3-entity-framework

Upvotes: 2

Jakub Konecki
Jakub Konecki

Reputation: 46008

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

<connectionStrings>
    <add name="AdventureWorksEntities" 
         connectionString="metadata=.\AdventureWorks.csdl|.\AdventureWorks.ssdl|.\AdventureWorks.msl;
         provider=System.Data.SqlClient;provider connection string='Data Source=localhost;
         Initial Catalog=AdventureWorks;Integrated Security=True;Connection Timeout=60;
         multipleactiveresultsets=true'" providerName="System.Data.EntityClient" />
</connectionStrings>

Upvotes: 2

Related Questions