When publishing from VS 2012 to Azure, my Entity Framework seed data is not inserted into Azure SQL

I have an ASP.NET MVC application that uses Entity Framework 5.0 and Code First.

I published my site using Visual Studio 2012 on the Azure Website. Everything seems to work, except that the seed data is not pasted into SQL Azure; the site is working, the database is built, but the source data is not . When I run this on my local machine, everything works correctly.

In the examples that I saw when publishing from Visual Studio 2012, there is the option "Perform the first code migration" (see the figure below).

enter image description here

But when I try to publish my site, the option "Perform the first code migration" is not . enter image description here

, - . 3 , .

  • -. ASP.NET MVC. Entity Framework, (DBContext) Dataโ€‹โ€‹li >
  • . . Entity Framework
  • . Entity Framework. , DbMigrationsConfiguration. Seed.

. ; - , , .

- , SQL Azure, Visual Studio 2012?

+5
1

pubxml (Properties/PublishingProfiles/YourName.pubxml), . , : http://www.dominicstpierre.net/2012/11/enable-code-first-migrations-check-box.html

<PublishDatabaseSettings>
  <Objects xmlns="">
    <ObjectGroup Name="Namespace.Models.YourDBClass" Order="1" Enabled="True">
      <Destination Path="your-connection-string-goes-here" />
      <Object Type="DbCodeFirst">
        <Source Path="DBMigration" DbContext="Namespace.Models.YourDBClass, AssamblyName" MigrationConfiguration="Namespace.Migrations.Configuration, Assambly" Origin="Convention" />
      </Object>
    </ObjectGroup>
  </Objects>
</PublishDatabaseSettings>

.Models.YourDBClass , DbContext, Namespace.Migratins.Configuration, Assambly Assassly.

, .

0

All Articles