fsprojects / SQLProvider

A general F# SQL database erasing type provider, supporting LINQ queries, schema exploration, individuals, CRUD operations and much more besides.
https://fsprojects.github.io/SQLProvider
Other
570 stars 144 forks source link

Resolution path not used for runtime execution (Oracle ODP.NET dll) #628

Open cil22 opened 5 years ago

cil22 commented 5 years ago

Description

Path to Oracle ODB.NET driver (e.g. Oracle.ManagedDataAccess.dll) is not used for runtime version. When executing a project compiled for .NET 4.7.3 / F# 4.6 with the SQLProvider, I run into an exception stating: "Unable to resolve assemblies. One of Oracle.ManagedDataAccess.dll, Oracle.DataAccess.dll must exist in the paths: ..." It seems the path given with parameter "ResolutionPath" is not used.

The same code is executed without errors in FSI (here the path given is definitely used).

Repro steps

  1. Setup new project in Visual Studio 2019 (F# Console App .NET Framework).

  2. Add SQLProvider via NuGet and setut initialization code (SqlDataProvider) with "ResolutionPath" set to Oracle-Driver directory.

Expected behavior

Runs like the FSI version and uses the Oracle.ManagedDataAccess.dll version from the Oracle driver installation.

Actual behavior

Exception is thrown "Unable to resolve assemblies" (see above).

Known workarounds

Seems like it works when I copy Oracle.ManagedDataAccess.dll to the .exe directory.

Related information

giuliohome commented 4 years ago

I'm having the same issue with SQLITE and, since I'm using SQL Provider inside a library, called from a web project in IIS, it works when I copy the required dll to the dll source folder instead of the bin folder of either the library or the final web project (this is what the exception message suggests in my case). Practically speaking I'm forced to link the sqlite driver to the project reference of my SQLProvider library, that defeats the purpose of using a ResolutionPath imo. It's funny that it works instead if I test the library from the F# interactive...

giuliohome commented 4 years ago

I've found that it works at runtime when I put the resolution path in the GetDataContext call !

let context = Sql.GetDataContext(myConnStr, resolutionPath)