iis - How do you declare or use variables in web.config -
because our web application using both entityframework , system.data.sqlclient, need have 2 . error prone, need make update both same data.
so wonder if posible add variables web.config xml?
<connectionstrings> <add name="server" value="sql2014" type="variable" /> <add name="database" value="mydb" type="variable" /> <add name="username" value="sqluser" type="variable" /> <add name="password" value="kaldsommer" type="variable" /> <add name="xreport" connectionstring="data source={server};initial catalog={mydb};user id={username};password={password}" providername="system.data.sqlclient" /> <add name="xentities" connectionstring="metadata=res://*/entities.xmodel.csdl|res://*/entities.xmodel.ssdl|res://*/entities.xmodel.msl;provider=system.data.sqlclient;provider connection string="data source{server};initial catalog={mydb};multipleactiveresultsets=true;app=entityframework;;persist security info=true;user id={username};password={password}"" providername="system.data.entityclient" /> </connectionstrings>
pr @bartude reply in comment.
faik, not possible. on other hand maintaining 2 connection strings not complicated, although agree it's best update things once
Comments
Post a Comment