Quantcast
Channel: Entity Framework
Viewing all articles
Browse latest Browse all 10318

Created Issue: As currently configured SQL Azure will not work with Model First EF DBContext [743]

$
0
0
Create a WebAPI or MVC project with a Model First EF Dal. Everything works fine. Now migrate Database to Sql Azure, and MVC Project to Azure Website. It is not possible to "out of the box" configure the Azure Website to correctly instantiate and have the Azure Website with a Model First EF Dal successfully connect to the Sql Azure instance.

It is required that you need to manually build up the the connection string, then override the Context.tt file to allow passing in the built up connection string. Please find attached the modified .tt that takes care of this for you, thinking we could do a minor Pull request here and incorporate my .tt changes.

With this .tt you can use the code locally and on Azure in the following way

var dal = <EntitiesContainerName>.NewContext("<StandardSqlClientConnectionName>", "<QualifiedMetadataInformation>"))

for example

public ActionResult Test()
{
using ( var dal = RinconEntities.NewContext("Rincon", "Dal.RinconDb"))
{
//do something
}
}





Viewing all articles
Browse latest Browse all 10318

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>