Cannot use Code First from database Wizard in Microsoft.EntityFrameworkCore version 1.0

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
niton_dev
Posts: 18
Joined: Thu 22 Jul 2010 14:44

Cannot use Code First from database Wizard in Microsoft.EntityFrameworkCore version 1.0

Post by niton_dev » Sat 13 Aug 2016 13:37

Image

Image


Can someone help me?

Shalex
Site Admin
Posts: 8245
Joined: Thu 14 Aug 2008 12:44

Re: Cannot use Code First from database Wizard in Microsoft.EntityFrameworkCore version 1.0

Post by Shalex » Mon 15 Aug 2016 11:23

Reverse engineering for EF Core is supported via Entity Developer shipped with the dotConnect for PostgreSQL installation. You can run it in the following way: right click your project in Solution Explorer > Add > New Item > Data > Devart EF Core Model, then follow the wizard steps to create a model. Does this help?

Generating a model via Package Manager Console is currently not supported.

More information:
https://www.devart.com/dotconnect/postg ... iderefcore
http://blog.devart.com/entity-framework ... pport.html
http://blog.devart.com/migrating-entity ... ork-7.html

niton_dev
Posts: 18
Joined: Thu 22 Jul 2010 14:44

Re: Cannot use Code First from database Wizard in Microsoft.EntityFrameworkCore version 1.0

Post by niton_dev » Tue 16 Aug 2016 18:20

It does not help me right now. Could you tell me when I can use scaffold with EF Core and dotConnect for PostgreSQL?

Shalex
Site Admin
Posts: 8245
Joined: Thu 14 Aug 2008 12:44

Re: Cannot use Code First from database Wizard in Microsoft.EntityFrameworkCore version 1.0

Post by Shalex » Thu 18 Aug 2016 13:28

niton_dev wrote:It does not help me right now.
Could you please specify the exact problem you have encountered with Entity Developer?

We recommend you to use Entity Developer (Devart Entity Model, *.edml) instead of EDM Designer (ADO.NET Entity Data Model, *.edmx) because it is adjusted for working with PostgreSQL and has an advanced functionality: http://www.devart.com/entitydeveloper/ed-vs-edm.html.

niton_dev
Posts: 18
Joined: Thu 22 Jul 2010 14:44

Re: Cannot use Code First from database Wizard in Microsoft.EntityFrameworkCore version 1.0

Post by niton_dev » Mon 19 Sep 2016 10:55

how do I map the associations (navigation properties) using the entity developer?
Image

Also, always I get the error below, using the develepor entity.
Image

Shalex
Site Admin
Posts: 8245
Joined: Thu 14 Aug 2008 12:44

Re: Cannot use Code First from database Wizard in Microsoft.EntityFrameworkCore version 1.0

Post by Shalex » Mon 19 Sep 2016 16:11

1. Please specify the DDL script of test tables for reproducing the error.
2. Tell us your current version (x.x.x) of dotConnect for PostgreSQL. You can check it via Tools > PostgreSQL > About.
3. What version (x.x.x) and capacity (32-bit or 64-bit) of PostgreSQL Server are you working with?

niton_dev
Posts: 18
Joined: Thu 22 Jul 2010 14:44

Re: Cannot use Code First from database Wizard in Microsoft.EntityFrameworkCore version 1.0

Post by niton_dev » Tue 20 Sep 2016 15:01

1. https://drive.google.com/file/d/0B8VSU_ ... VVaUk/view
2. I am using dotConnect for PostgreSQL version 7.6.729.0. https://drive.google.com/open?id=0B8VSU ... VdjTndpYWc
3. PostreSQL version: PostgreSQL 9.5.0, compiled by Visual C++ build 1800, 64-bit

Shalex
Site Admin
Posts: 8245
Joined: Thu 14 Aug 2008 12:44

Re: Cannot use Code First from database Wizard in Microsoft.EntityFrameworkCore version 1.0

Post by Shalex » Tue 20 Sep 2016 18:12

Thank you for the DDL script. I have added all database objects to *.efml (Devart EF Core Model) via Create Model Wizard: all associations are valid (just some tables do not have primary keys). Please specify the exact steps we should follow to reproduce the "operator is not unique: smallint[] @> smallint[]" error in our environment.

niton_dev
Posts: 18
Joined: Thu 22 Jul 2010 14:44

Re: Cannot use Code First from database Wizard in Microsoft.EntityFrameworkCore version 1.0

Post by niton_dev » Tue 20 Sep 2016 20:01

Gif with steps to reproduce the problem.
I used the same database I sent to you.
https://drive.google.com/open?id=0B8VSU ... lY5aVRYcjg

niton_dev
Posts: 18
Joined: Thu 22 Jul 2010 14:44

Re: Cannot use Code First from database Wizard in Microsoft.EntityFrameworkCore version 1.0

Post by niton_dev » Wed 21 Sep 2016 09:08

This is log error in \data\pg_log:

2016-09-21 06:05:55 BRT ERROR: operator is not unique: smallint[] @> smallint[] at character 537
2016-09-21 06:05:55 BRT HINT: Could not choose a best candidate operator. You might need to add explicit type casts.
2016-09-21 06:05:55 BRT STATEMENT:

Code: Select all

	
SELECT

	  a.conname as CONSTRAINT_NAME,

	  ns.nspname as CONSTRAINT_SCHEMA,

	  mycl.relname as TABLE_NAME, 

	  b.conname as REFERENCED_CONSTRAINT_NAME,

	  frns.nspname as REFERENCED_SCHEMA,

	  frcl.relname as REFERENCED_TABLE_NAME,

	  a.confupdtype as UPDATE_RULE,

	  a.confdeltype as DELETE_RULE, 

	  b.contype as REFERENCED_CONSTRAINT_TYPE

	,

	  a.conkey as CONSTRAINT_KEY_INDEXES,

	  a.confkey as REFERENCED_CONSTRAINT_KEY_INDEXES

	FROM 

	  pg_constraint a

	INNER JOIN

	  pg_constraint b ON (a.confrelid = b.conrelid AND a.confkey @> b.conkey AND array_length(a.confkey, 1) = array_length(b.conkey, 1))

	INNER JOIN 

	  pg_namespace ns ON a.connamespace= ns.oid

	INNER JOIN 

	  pg_class mycl ON a.conrelid = mycl.oid

	LEFT OUTER JOIN 

	  pg_class frcl ON a.confrelid = frcl.oid 

	INNER JOIN pg_namespace frns ON frcl.relnamespace= frns.oid

	WHERE a.contype = 'f' 

	  AND (b.contype = 'p' OR b.contype = 'u')

	AND

	  ns.nspname = frns.nspname

	AND

	  ns.nspname = 'public'

niton_dev
Posts: 18
Joined: Thu 22 Jul 2010 14:44

Re: Cannot use Code First from database Wizard in Microsoft.EntityFrameworkCore version 1.0

Post by niton_dev » Wed 21 Sep 2016 09:55

I found the cause of the error. The error occurs if, in the database, the extension intarray is installed.

niton_dev
Posts: 18
Joined: Thu 22 Jul 2010 14:44

Re: Cannot use Code First from database Wizard in Microsoft.EntityFrameworkCore version 1.0

Post by niton_dev » Thu 22 Sep 2016 11:54

What have I do to use Entity Developer with extension intarray installed?

Shalex
Site Admin
Posts: 8245
Joined: Thu 14 Aug 2008 12:44

Re: Cannot use Code First from database Wizard in Microsoft.EntityFrameworkCore version 1.0

Post by Shalex » Fri 23 Sep 2016 18:47

Thank you for your report. We have reproduced the issue and are investigating it. We will notify you about the result.

Shalex
Site Admin
Posts: 8245
Joined: Thu 14 Aug 2008 12:44

Re: Cannot use Code First from database Wizard in Microsoft.EntityFrameworkCore version 1.0

Post by Shalex » Thu 06 Oct 2016 16:44

The bug with retrieving metadata from PostgreSQL server with the intarray extension installed is fixed: viewtopic.php?f=3&t=34382.

Shalex
Site Admin
Posts: 8245
Joined: Thu 14 Aug 2008 12:44

Re: Cannot use Code First from database Wizard in Microsoft.EntityFrameworkCore version 1.0

Post by Shalex » Fri 09 Dec 2016 16:24

The Scaffold-DbContext NuGet command of Package Manager Console for generating a model basing on the existing database schema is supported in EF Core: viewtopic.php?f=3&t=34690.

Post Reply