EF 6.0.0 - Do not create a database from scratch

I am using a .NET 4.0 project. I installed the EF-version 6.0.0 nuget package.

I added a class library, installed EF, then enabled migrations, added my DB Context class and inside my App.config, I added this configuration section:

<contexts>
  <context
    type="DataLayer.MiddlewareDbContext, DataLayer">
    <databaseInitializer
      type="System.Data.Entity.MigrateDatabaseToLatestVersion`2[[
        DataLayer.MiddlewareDbContext, DataLayer], 
        [DataLayer.Migrations.Configuration, DataLayer]], EntityFramework" />
  </context>
</contexts>

When I launch the application, I get the following exceptions when I try to access the DB Context:

Method not found: 'System.Data.Entity.Migrations.Model.ColumnModel System.Data.Entity.Migrations.Builders.ColumnBuilder.String(System.Nullable`1<Boolean>, System.Nullable`1<Int32>, System.Nullable`1<Boolean>, System.Nullable`1<Boolean>, System.String, System.String, System.String, System.String, System.Collections.Generic.IDictionary`2<System.String,System.Data.Entity.Infrastructure.Annotations.AnnotationValues>)'.

Also note that the database is not created!

The Migrations folder already contains one migration file containing all the models, I have a + configuration class.

Rate it.

Hi

+4
source share
1 answer

, EntityFramework Nuget .

, , EntityFramework, "" . .

+3

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


All Articles