Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Entity Framework Perplexities
Message
Information générale
Forum:
ASP.NET
Catégorie:
Entity Framework
Versions des environnements
Environment:
C# 5.0
OS:
Windows 10
Network:
Windows Server 2012
Database:
MS SQL Server
Application:
Desktop
Divers
Thread ID:
01646424
Message ID:
01646496
Vues:
35
>>
>>I usually create a custom configuration (although you might be able to use the standard 'Debug' and 'Release' configurations) and use web.config transforms. Little bit of work setting up but well worth it once in place since you only have to change 'common' settings in one place. See:
>>https://msdn.microsoft.com/en-us/library/dd465318(v=vs.100).aspx
>
>Many thanks. As always.
>
>I guess the same logic would apply to app.config.
>
>It's not exactly what I was looking for, but it does give me some clue of how to proceed.

It's pretty straightforward. If you can use, say, the standard release config to change the default then it should just look like this:
<?xml version="1.0"?>

<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
   <connectionStrings>
      <add name="PGSheetControlEntities" connectionString="metadata=res://*/PGSheetModel.csdl|res://*/PGSheetModel.ssdl|res://*/PGSheetModel.msl;provider=System.Data.SqlClient;provider connection string="Data Source=192.168.0.15;Initial Catalog=PGSheetControl;User ID=sa;Password=xxxxx ;MultipleActiveResultSets=True"" providerName="System.Data.EntityClient"
        xdt:Transform="Replace" xdt:Locator="Match(name)"/>
  </connectionStrings>
</configuration>
i.e. copy the default entry for the 'add' attribute, change the Data Source (and any other parameters that are different and add the xdt:Transform attribute. You can right click on the release config and use 'Preview Transform' to confirm that everything is correct.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform