SlowCheetah does not convert to EntityFramework migration

I am using EF Code-First Migrations: https://msdn.microsoft.com/en-us/data/jj591621.aspx add-migration , update-databaseetc. all are called from the package manager console in VS.

I also use SlowCheetah to manage the various environments that we have, in particular, managing the fact that each developer has their own copy of the database so that they can update their model changes without blocking everyone else from the database. Thus, one of the configuration values ​​that changes is the name of the target database.

(For reasons that I will not enter, we do not use the settings connectionStrings .configas such, but rather have the database names in blocks appSettings)

My project, containing models and migrations, is a project TheCustomer.Database.

If I manually changed the value appSettingin TheCustomer.Database/app.configand started the migration, it used the configuration value correctly - so the configuration basically works.

But if I configure the SlowCheetah transform to change the value for this assembly configuration, select this configuration, rebuild the code, and then start the migration, then it will not apply the transformation; it uses the value in the database app.config, notapp.SelectBuildConfig.config

SlowCheetah works fine at all - when I run sln to get the site, it uses the correct Db as defined by VS Build Config.

Any thoughts?

EDIT:

ConfigFile:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>

    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --></configSections>
  <appSettings>
    <add key="DbName" value="This Default Value shouldn't work - you should be using a value for a specific build" />
    <add key="DbPassword" value="SomePassword" />
  </appSettings>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="mssqllocaldb" />
      </parameters>
    </defaultConnectionFactory>
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
  </entityFramework>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /></startup></configuration>

And conversion

<?xml version="1.0" encoding="utf-8" ?>
<!-- For more information on using transformations 
     see the web.config examples at http://go.microsoft.com/fwlink/?LinkId=214134. -->
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
    <appSettings>
        <add key="DbName" value="LocalDev_MDM" xdt:Transform="SetAttributes" xdt:Locator="Match(key)"/>
    </appSettings>
</configuration>
+4
source share

Source: https://habr.com/ru/post/1609636/


All Articles