Page 1 of 1

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

Posted: Sat 13 Aug 2016 13:37
by niton_dev
Image

Image


Can someone help me?

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

Posted: Mon 15 Aug 2016 11:23
by Shalex
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

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

Posted: Tue 16 Aug 2016 18:20
by niton_dev
It does not help me right now. Could you tell me when I can use scaffold with EF Core and dotConnect for PostgreSQL?

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

Posted: Thu 18 Aug 2016 13:28
by Shalex
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.

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

Posted: Mon 19 Sep 2016 10:55
by niton_dev
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

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

Posted: Mon 19 Sep 2016 16:11
by Shalex
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?

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

Posted: Tue 20 Sep 2016 15:01
by niton_dev
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

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

Posted: Tue 20 Sep 2016 18:12
by Shalex
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.

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

Posted: Tue 20 Sep 2016 20:01
by niton_dev
Gif with steps to reproduce the problem.
I used the same database I sent to you.
https://drive.google.com/open?id=0B8VSU ... lY5aVRYcjg

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

Posted: Wed 21 Sep 2016 09:08
by niton_dev
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'

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

Posted: Wed 21 Sep 2016 09:55
by niton_dev
I found the cause of the error. The error occurs if, in the database, the extension intarray is installed.

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

Posted: Thu 22 Sep 2016 11:54
by niton_dev
What have I do to use Entity Developer with extension intarray installed?

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

Posted: Fri 23 Sep 2016 18:47
by Shalex
Thank you for your report. We have reproduced the issue and are investigating it. We will notify you about the result.

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

Posted: Thu 06 Oct 2016 16:44
by Shalex
The bug with retrieving metadata from PostgreSQL server with the intarray extension installed is fixed: viewtopic.php?f=3&t=34382.

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

Posted: Fri 09 Dec 2016 16:24
by Shalex
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.