efcore.pg icon indicating copy to clipboard operation
efcore.pg copied to clipboard

Unable to scaffold dbcontext (Database First)

Open billcheng opened this issue 10 years ago • 1 comments

In my project.json,

"dependencies": {
    "Microsoft.EntityFrameworkCore": "1.0.0-rc2-final",
    "Npgsql.EntityFrameworkCore.PostgreSQL": "1.0.0-rc2-release1",
    "Npgsql.EntityFrameworkCore.PostgreSQL.Design": "1.0.0-rc2-release1"
},
"tools": {
    "Microsoft.EntityFrameworkCore.Tools": {
      "version": "1.0.0-preview1-final",
      "imports": [
        "portable-net45+win8+dnxcore50",
        "portable-net45+win8"
      ]
    }
  }

when i run at command prompt

dotnet ef dbcontext scaffold "<connection string>" Npgsql.EntityFrameworkCore.PostgreSQL.Design

I got this:

One or more errors occurred. (Unable to find expected assembly attribute named DesignTimeProviderServicesAttribute in provider assembly Npgsql.EntityFrameworkCore.PostgreSQL.Design. This attribute is required to identify the class which acts as the design-time service provider factory.)

billcheng avatar May 29 '16 02:05 billcheng

The problem is that you specified Npgsql.EntityFrameworkCore.PostgreSQL.Design as your provider, this should be Npgsql.EntityFrameworkCore.PostgreSQL (see the EFCore getting started docs).

roji avatar May 29 '16 08:05 roji