fsprojects / fsprojects/FSharp.Data.SqlClient

SQLite and SqlEnumProvider

Open
#273 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
F#
Stars
206
Forks
66
PR merge metrics
No merged PRs in 30d

Description

Description

I'm trying to connect to SQLite ADO.NET provider

Repro steps

Here it is the repro

  1. Visual Studio 2016 .Net 462 a new F# console project

  2. Install FSharp.Data.SqlClient from nuget

  3. Add Reference System.Data.SQLite.dll

and also in app.config

<system.data>
    <DbProviderFactories>
        <remove invariant="System.Data.SQLite" />
        <add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".Net Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite, Version=1.0.96.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139" />
    </DbProviderFactories>
</system.data>

where I got the public token from
"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\sn.exe" -T System.Data.SQLite.dll

  1. Printed the following

printfn "%A" [ for r in DbProviderFactories.GetFactoryClasses().Rows -> r.["InvariantName"] ]

I see System.Data.SQLite is present in the output

  1. Try to code the following lines (assuming a DBTest sqlite version 3 is already available)
     namespace SO
     module CompanyDAL =
        open FSharp.Data 
        open System.Data
        open System.Data.SQLite
        [<Literal>]
        let conn = "Data Source=TESTDB;Version=3;"
        [<Literal>]
        let baseQuery       = "select id, name from company  "
        type GetCompany = SqlEnumProvider<baseQuery, conn,"System.Data.SQLite">
Expected behavior

I would expect to be able to see the SQLite DB through its Ado.Net provider.

Actual behavior

I'm getting the error:
error FS3033: The type provider 'FSharp.Data.SqlEnumProvider' reported an error: Unable to find the requested .Net Framework Data Provider. It may not be installed.

Known workarounds

I'm not aware of any workarounds.

Related information
  • Windows 7
  • SQLite Version 3
  • .NET Runtime 462
  • Visual Studio Community 2015
  • F# 4.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with SqlEnumProvider and the DbProviderFactories lookup described in the repro, then reproduce the failure in the F# console project using System.Data.SQLite. Trace why the System.Data.SQLite invariant is not resolved and verify completion when the provider can inspect the SQLite database and generate GetCompany without FS3033.

Written by the indexing model from the issue text.

Assessment

Tech stack
fsharp, sqlite
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.