EF Core Query

Discussion of open issues, suggestions and bugs regarding Entity Developer - ORM modeling and code generation tool
guinness
Posts: 25
Joined: Tue 22 Nov 2016 03:19

EF Core Query

Post by guinness » Sat 10 Dec 2016 21:33

I downloaded Entity Developer version 6.0.147 and using MySQL Connector/Net version 7.0.6 with EF Core. When I create a new query on the model, I get the following error:

Code: Select all

Could not find the assembly 'Microsoft.EntityFrameworkCore.dll'. Specify the paths to the required assemblies in the EntityDeveloper.exe.config file. For more information please see the documentation.
I wasn't able to find the documentation reference, but instead I copied the following files into the application folder:

Microsoft.EntityFrameworkCore.dll
Microsoft.EntityFrameworkCore.Relational.dll
Microsoft.Extensions.Caching.Abstractions.dll
Microsoft.Extensions.Caching.Memory.dll
Microsoft.Extensions.DependencyInjection.Abstractions.dll
Microsoft.Extensions.DependencyInjection.dll
Microsoft.Extensions.Logging.Abstractions.dll
Microsoft.Extensions.Logging.dll
Microsoft.Extensions.Options.dll
Microsoft.Extensions.Primitives.dll
MySql.Data.dll
MySql.Data.EntityFrameworkCore.dll
Remotion.Linq.dll
System.Collections.Immutable.dll
System.Diagnostics.DiagnosticSource.dll
System.Interactive.Async.dll

However, then I got the following error and I got stuck here since I also copied that assembly to the folder but it made no difference. Any suggestions, or wait for a new release to fix this?

Code: Select all

The result of model generation or query syntax is not valid.
Failed to compile and load the working library with the model.
Error List:
error1 : The type 'System.Linq.IQueryable`1<T0>' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Linq.Expressions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
error2 : The type 'System.Linq.IQueryable' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Linq.Expressions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
Also, when using the Retrieve Data on a table from the Database Explorer context menu, I get the following exception:

Code: Select all

Message: Object reference not set to an instance of an object.
Source: EntityDeveloper.Common
TargetSite: System.Data.Common.DbDataAdapter GetDataAdapter(System.String, System.String, System.String ByRef)
HelpLink: 
Type: System.NullReferenceException
Stack:
   at EntityDeveloper.Vendor.GetDataAdapter(String schemaName, String tablename, String& readOnlyMessage)
   at EntityDeveloper.ModelDialogProvider.ShowTablePreviewData(String schema, String name)
   at EntityDeveloper.gh.g(Object A_0, ItemClickEventArgs A_1)

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

Re: EF Core Query

Post by Shalex » Thu 15 Dec 2016 14:52

Thank you for your report. We will investigate the case and notify you about the result.

guinness
Posts: 25
Joined: Tue 22 Nov 2016 03:19

Re: EF Core Query

Post by guinness » Wed 07 Jun 2017 19:55

@Shalex - any update? I tried this again with 6.1.265 version and it still has the same problem.

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

Re: EF Core Query

Post by Shalex » Thu 08 Jun 2017 16:00

MySql.Data.EntityFrameworkCore has only a prerelease version, and it uses a prerelease version of MySql.Data which is unsigned and cannot be loaded in the process of Visual Studio. We are planning to support the Query Data and Retrieve Data features for MySql.Data.EntityFrameworkCore after it is released.

guinness
Posts: 25
Joined: Tue 22 Nov 2016 03:19

Re: EF Core Query

Post by guinness » Fri 09 Jun 2017 19:23

Dang, at the pace the Connector/Net development is taking those libraries will be prerelease for a while.

Would it be possible to use a tool like https://brutaldev.com/post/NET-Assembly ... ame-Signer to sign those assemblies myself so it'll work? Any guidance would be welcome.

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

Re: EF Core Query

Post by Shalex » Tue 13 Jun 2017 07:02

Modifying the Connector/Net provider exceeds the goals of our support. Please contact the Connector/Net support team and ask them to release a stable signed version (if possible). As a workaround, please use dotConnect for MySQL.

guinness
Posts: 25
Joined: Tue 22 Nov 2016 03:19

Re: EF Core Query

Post by guinness » Tue 13 Jun 2017 20:13

@Shalex - it appears that the latest release of Connector/Net now has signed assemblies.

Previous version 7.0.6-IR31 was:

Code: Select all

MySql.Data.EntityFrameworkCore.dll is a delay-signed or test-signed assembly
Latest version 7.0.7-m61 now:

Code: Select all

Assembly 'MySql.Data.EntityFrameworkCore.dll' is valid

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

Re: EF Core Query

Post by Shalex » Thu 15 Jun 2017 09:27

We will investigate the question and notify you about the result.

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

Re: EF Core Query

Post by Shalex » Wed 28 Jun 2017 15:31

1. The bug with throwing System.NullReferenceException when using the Retrieve Data functionality via Database Explorer in EF Core Model is fixed (MySQL Connector/Net) in Entity Developer v6.1.284.

2. The Query / Retrieve Data functionality of EF Core Model doesn't work because the prerelease version of Connector/Net references old versions of System.Interactive.Async и Remotion.Linq. The issue can be fixed by adding this entry to
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\devenv.exe.config" (for VS2017) or to
"C:\Program Files (x86)\Devart\EntityDeveloper\EntityDeveloper.exe.config" (for standalone ED):

Code: Select all

      <dependentAssembly>
        <assemblyIdentity name="System.Interactive.Async" publicKeyToken="94bc3704cddfc263" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-3.0.3000.0" newVersion="3.0.3000.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Remotion.Linq" publicKeyToken="fee00910d6e5f53b" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
      </dependentAssembly>
Be aware that this fix is NOT RECOMMENDED to apply (may break some other functionality).

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

Re: EF Core Query

Post by Shalex » Wed 28 Jun 2017 16:19

3. Additional step to use Query functionality of EF Core Model in a standalone Entity Developer is required: create a folder and copy these assemblies into it

"Microsoft.EntityFrameworkCore"
"Microsoft.EntityFrameworkCore.Relational"
"Microsoft.Extensions.Primitives"
"Microsoft.Extensions.Options"
"Microsoft.Extensions.DependencyInjection"
"Microsoft.Extensions.DependencyInjection.Abstractions"
"Microsoft.Extensions.Logging"
"Microsoft.Extensions.Logging.Abstractions"
"Microsoft.Extensions.Caching.Abstractions"
"Microsoft.Extensions.Caching.Memory"
"System.Diagnostics.DiagnosticSource"
"System.Collections.Immutable"
"System.Interactive.Async"
"Remotion.Linq"
"MySql.Data.EntityFrameworkCore"
"MySql.Data"


then specify the path to this folder in the core-assemblies-path tag of C:\Program Files (x86)\Common Files\Devart\EntityDeveloper\EntityDeveloper.exe.config:

Code: Select all

    <EFCore core-assemblies-path="D:\PathToFolder\">

guinness
Posts: 25
Joined: Tue 22 Nov 2016 03:19

Re: EF Core Query

Post by guinness » Wed 28 Jun 2017 22:58

Thanks Shalex, I downloaded version 6.1.284 and followed instructions. I can confirm that for item 1 (Retrieve Data functionality via Database Explorer) it works.

However for item 2 (Query / Retrieve Data of EF Core Model), I'm still unable to get that to working and get the same error as before:
You must add a reference to assembly 'System.Linq.Expressions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
Any further suggestions would be welcome.

FWIW, I also have the same error when using the Sqlite provider (after copying Microsoft.EntityFrameworkCore.Sqlite.dll & Microsoft.Data.Sqlite.dll into folder).

guinness
Posts: 25
Joined: Tue 22 Nov 2016 03:19

Re: EF Core Query

Post by guinness » Thu 29 Jun 2017 23:08

It's possible I'm using different versions of assemblies than you are which may cause problems.

Code: Select all

Get-ChildItem -Filter *.dll -Recurse | Select-Object -ExpandProperty VersionInfo
I ran the PowerShell command above which shows the versions I'm using.

Code: Select all

ProductVersion   FileVersion      FileName
--------------   -----------      --------
1.1.1            1.1.1.30217      Microsoft.EntityFrameworkCore.dll
1.1.1            1.1.1.30217      Microsoft.EntityFrameworkCore.Relational.dll
1.1.1            1.1.1.30217      Microsoft.Extensions.Caching.Abstractions.dll
1.1.1            1.1.1.30217      Microsoft.Extensions.Caching.Memory.dll
1.1.0-rtm-22752  1.1.0.21115      Microsoft.Extensions.DependencyInjection.Abstractions.dll
1.1.0-rtm-22752  1.1.0.21115      Microsoft.Extensions.DependencyInjection.dll
1.1.1            1.1.1.30217      Microsoft.Extensions.Logging.Abstractions.dll
1.1.1            1.1.1.30217      Microsoft.Extensions.Logging.dll
1.1.1            1.1.1.30217      Microsoft.Extensions.Options.dll
1.1.0-rtm-22752  1.1.0.21115      Microsoft.Extensions.Primitives.dll
7.0.7-m61        7.0.7.0          MySql.Data.dll
7.0.7-m61        7.0.7.0          MySql.Data.EntityFrameworkCore.dll
2.1.1+Release... 2.1.1.30000      Remotion.Linq.dll
4.6.24705.01.... 4.6.24705.01     System.Collections.Immutable.dll
4.6.25220.01.... 4.6.25220.01     System.Diagnostics.DiagnosticSource.dll
3.0.0+Branch.... 3.0.0.0          System.Interactive.Async.dll

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

Re: EF Core Query

Post by Shalex » Tue 04 Jul 2017 18:43

guinness wrote:
You must add a reference to assembly 'System.Linq.Expressions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
We cannot reproduce the issue in our environment at the moment. Please give us the following information:
1. Are you getting this error with a standalone Entity Developer or with the one integrated in Visual Studio?
2. Specify the version of your Visual Studio.
3. Tell us the type of your Visual Studio project (.NET Framework or .NET Core).

gmilczarek
Posts: 6
Joined: Tue 08 Sep 2015 18:54

Re: EF Core Query

Post by gmilczarek » Wed 05 Jul 2017 14:09

I got exactly the same error:
The result of model generation or query syntax is not valid.
Failed to compile and load the working library with the model.
Error List:
error1 : Typ „System.Linq.IQueryable`1<T0>” jest zdefiniowany w zestawie, do którego nie istnieje żadne odwołanie. Musisz dodać odwołanie do zestawu „System.Linq.Expressions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”.
error2 : Typ „System.Linq.IQueryable” jest zdefiniowany w zestawie, do którego nie istnieje żadne odwołanie. Musisz dodać odwołanie do zestawu „System.Linq.Expressions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”.
1. I got this error with a standalone Entity Developer
2. I use Visual Studio 2017 Professional
3. .Net Core project

guinness
Posts: 25
Joined: Tue 22 Nov 2016 03:19

Re: EF Core Query

Post by guinness » Wed 05 Jul 2017 21:25

Answers to questions:

1. Standalone
2. VS 2017 Professional
3. .NET Core project

I did also try to run queries from within VS 2017, but getting the error below. I'm unsure if there is an equivalent core-assemblies-path attribute for devenv.exe.config file.
Could not load file or assembly 'Microsoft.EntityFrameworkCore' or one of its dependencies. The system cannot find the file specified.

Post Reply