Skip to content

Instantly share code, notes, and snippets.

@blachniet
Created January 11, 2013 18:59
Show Gist options
  • Save blachniet/4513046 to your computer and use it in GitHub Desktop.
Save blachniet/4513046 to your computer and use it in GitHub Desktop.
The default DbContext generation script only generates one constructor for the DbContext. That constructor takes no arguments, so it is not possible to progromatically create the database connection string. If you add the constructor manually, your changes will be erased the next time the generation script is run. To fix this, add the following …
public <#=code.Excape(container)#>(string connectionString)
: base(connectionString)
{
<#
if (!loader.IsLazyLoadingEnabled(container))
{
#>
this.Configuration.LazyLoadingEnabled = false;
<#
}
#>
}
@blachniet
Copy link
Author

Excape should be Escape

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment