Constructor of Dbcontext keeps changing the base argument on update of model

c# entity-framework entity-framework-6 visual-studio

Accepted Answer

Activate your "your name." Context.tt and save the ensuing modification

<#=Accessibility.ForType(container)#> partial class <#=code.Escape(container)#> : DbContext
{
    public <#=code.Escape(container)#>()
        : base("name=<#=container.Name#>")
    {
<#

In quotes where it says "name=<#=container.Name#>"

exchange it with

<#=Accessibility.ForType(container)#> partial class <#=code.Escape(container)#> : DbContext
{
    public <#=code.Escape(container)#>()
        : base("metadata = res://*/fda.csdl|res://*/fda.ssdl|res://*/fda.msl;provider=System.Data.SqlClient;provider connection string='data source=MyServer;initial catalog=CitywideEmployees;persist security info=True;user id=MyUserID;password=MyPassword!;MultipleActiveResultSets=True;App=EntityFramework'")
    {
<#

Save the.tt file.

1
9/30/2018 6:35:32 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow