orientechnologies / OrientDB.Net.Core

Experimental Modular OrientDB .Net Core Driver.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error connect database

opened this issue · comments

When create connection to database, program show error

System.TypeLoadException: 'Method 'ExecutePreparedQuery' in type 'OrientDB.Net.ConnectionProtocols.Binary.Core.OrientDBBinaryConnection' from assembly 'OrientDB.Net.ConnectionProtocols.Binary, Version=0.1.12.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.'

https://ibb.co/fy9h9a

Prepared Queries are currently a work in-progress, as a result, they are not completely operational.

So how is one supposed to get around this problem for the moment? The issue is not that we want to use prepared queries but rather that the binary protocol, which is the only one available, does not implement IOrientDatabaseConnection. There seems to be no way to get a version of Core+Protocol+Serializer that can even connect to a database.

If anyone runs into this problem here is how I managed to at least get Core + Binary Protocol + CSV serializer to work to the point where I can connect to a database. Any input from more knowledgeable people would be greatly appreciated because what I did here doesn't quite feel as if it's by the book.

The problem is that BinaryProtocol 0.1.12 (the latest at the moment) does not implement IOrientDatabaseConnection.ExecutePreparedQuery(). If you look at binary protocol it wants Core 0.1.11. But downgrading to that isn't possible because the CSV serializer wants Core >= 0.1.16.

  1. I pulled the binary protocol project and added a dummy implementation for the missing method (it just throws a NotImplementedException).
  2. Upgrade the binary protocol to OrientDB.Net.Core 0.1.16. That's impossible out of the box because that version of core targets NetStandard1.6 while the binary protocol targets both CoreApp1.0 and NetFramework4.5.1, the latter being incompatible with NetStandard1.6. Sigh. To get around that, unload the binary protocol project in VS, then edit its csproj file to target NetStandard1.6 (I'm sure we could also just target, say, CoreApp1.1. but this worked for me).
    After that compilation will fail: in OrientDBNetworkConnection.Dispose() you need to make sure to call _socket.Dispose() so you either have to fix that #if clause or just comment the whole clause out and only call _socket.Dispose().
  3. Now rebuild the binary protocol
  4. Go into your client project and reference your own assembly of binary protocol and get OrientDB.Net.Core 0.1.16 and the latest CSV serializer.

That should be it. I would be glad to help updating the BinaryProtocol project but it's hard to see what the roadmap there is and how one could contribute.