FirebirdSQL / NETProvider

Firebird ADO.NET Data Provider
https://www.firebirdsql.org/en/net-provider/
Other
152 stars 62 forks source link

EDMX wizard failing using BlackbirdSql with EntityFramework.Firebird 10.0.1 #1174

Closed BlackbirdSQL closed 1 week ago

BlackbirdSQL commented 3 weeks ago

I've had to rollback from FirebirdSql.Data.FirebirdClient 10.2.0 and EntityFramework 10.0.1 to 10.0.0.

The EDMX wizard terminates after selecting a Firebird connection. The wizard is not the best software ever written which makes it extremely difficult to debug. Running it in the debugger gives me nothing.

I'm suspecting it's something in the Firebird EntityFramework package that is breaking because I'm doing some pretty heavy stuff in the DDEX module and it's all working fine except for the EDMX. I'm also using async calls exclusively in the SqlEditor module together with the FbScript parser and execution plans and that's still working.

I'll download the EntityFramework.Firebird source and put in some tracing to see if I can find the problem, but if you can think of something that may be causing this let me know.

cincuranet commented 2 weeks ago

From your description nothing pops up.

BlackbirdSQL commented 2 weeks ago

Okay so I left the FirebirdSql.Data.FirebirdClient 10.2.0 package as is and rebuilt the EntityFramework.Firebird 10.0.1 project. The rebuilt EF dll works so the issue can only be with the build. What version of the IDE are you on?

cincuranet commented 2 weeks ago

VS2022

BlackbirdSQL commented 2 weeks ago

VS2022 17.?.?

BlackbirdSQL commented 2 weeks ago

I'm on 17.9.7. If I do a straight swop out of the library, the one I built on 17.9.7 works, the other fails. I'll rollback to the version you built 10.0.1 on and work from there.

cincuranet commented 2 weeks ago

At the moment I have 17.10.1.

BlackbirdSQL commented 1 week ago

This is frustrating man. As soon as I build EntityFramework.Firebird the issue won't replicate.

BlackbirdSQL commented 1 week ago

It's a versioning issue. Extensions load assemblies in a different context to the user's "project" contexts. For example the BlackbirdSql extension includes a copy of the FirebirdClient dll in the vsix and registers it with the IDE, because a solution may not even be open when the assembly is required. If the Firebird EntityFramework assembly is not loaded in the IDE's context, the edmx wizard extension will look for it in the target project's app.config to identify it and any dependencies, but that's it. It doesn't care about a project's binding redirects. This is the correct behavior. The IDE's dependency manager then uses the library's AssemblyRef metadata table to establish the versions of referenced libraries.

This is where the issue is. EntityFramework.Firebird 10.0.1 was built using EF6ReferenceProviderVersion set to 10.1.0 for the client assembly.

I want to see if I can't include the Firebird EF assembly in the BlackbirdSql extension and register it with the IDE. That way it wouldn't matter what versions the user has in their projects.

BlackbirdSQL commented 1 week ago

I've managed to ring fence the IDE and Extension context, so the versioning issues between the FirebirdClient and EntityFramework assemblies have ended up being a blessing in disguise. This gives Firebird the same functionality as SqlServer, making it, and the built-in SqlClient (used for SqlServer and Oracle databases), the only two clients in Visual Studio able support any chosen version of their EntityFramework implementations in individual projects, and still use the wizards. All that remains is to clean up the Firebird SqlEditor Intellisense, predictive text and SQL snippets and I think I'm done with this extension. iSql seems to be working fine using your FbScript parser, and query statistics snapshots are as good as they're going to get using the available Firebird isc codes. I may look at integrating the execution plans into the graphics viewer at a later stage, but for now those will remain text based.