EF 5 Enable-Migrations : No context type was found in the assembly

后端 未结 24 2075
野的像风
野的像风 2020-12-02 11:51

I have 4 projects :

Toombu.Entities : all models are there
Toombu.DataAccess: Mapping, Repository and ToombuContext
Toombu.Logique : Logic of my application         


        
24条回答
  •  清歌不尽
    2020-12-02 12:49

    I got this problem first: PM> add-migration first

    No migrations configuration type was found in the assembly 'MyProjectName'. (In Visual Studio you can use the Enable-Migrations command from Package Manager Console to add a migrations configuration).

    then i tried this:

    PM> Enable-Migrations No context type was found in the assembly 'MyProjectName'.

    Then the right command for me :

    PM> Enable-Migrations -ProjectName MyProjectName -ContextTypeName MyProjectName.Data.Context

    After that i got this error message even though Context inherits from DbContext

    The type 'Context' does not inherit from DbContext. The DbMigrationsConfiguration.ContextType property must be set to a type that inherits from DbContext.

    Then i Installed Microsoft.EntityFrameworkCore.Tools

    ITS OK NOW but the message is funny. i already tried add migrations at first :D

    Both Entity Framework Core and Entity Framework 6 are installed. The Entity Framework Core tools are running. Use 'EntityFramework6\Enable-Migrations' for Entity Framework 6. Enable-Migrations is obsolete. Use Add-Migration to start using Migrations.

提交回复
热议问题