CLibNl.OleDb 1.0.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package CLibNl.OleDb --version 1.0.2
NuGet\Install-Package CLibNl.OleDb -Version 1.0.2
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CLibNl.OleDb" Version="1.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CLibNl.OleDb --version 1.0.2
#r "nuget: CLibNl.OleDb, 1.0.2"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install CLibNl.OleDb as a Cake Addin
#addin nuget:?package=CLibNl.OleDb&version=1.0.2

// Install CLibNl.OleDb as a Cake Tool
#tool nuget:?package=CLibNl.OleDb&version=1.0.2

Setting Up Records

Create an F# record as follows:

  • Decorate all instance fields with the OleDbColumn attribute
  • Add the following static get properties to the record:
Tables           : OleDbTable[]
Links            : OleDbTableLink[]
ConnectionString : OleDbConnectionStringBuilder

Example

type Test =
    {
        [<OleDbColumn("table1", "field", "Field1", "Some field.", null)>]
        Field1    : string
        [<OleDbColumn("table2", "otherField", "Field2", "Some other field.", null)>]
        Field2    : string
    }

    static member Tables 
        with get() =
            [|
                {
                    FullTablePath = "table1"
                    TableAlias = "table1"
                }
                {
                    FullTablePath = "table2"
                    TableAlias = "table2"
                }
            |]


    static member Links
        with get() =
            [|
                {
                    Table1 = "table1"
                    Field1 = "field"
                    Table2 = "table2"
                    Field2 = "otherField"
                }
            |]

Get records as follows:

let records, errors = OleDbQuery<Test>().QueryAndMapToRecord()

To execute the query async:

    let fSuccess(e:OleDbQueryCompletedEventArgs<T>) = 
        if e.HasErrors |> not then
            e.Records.Value
            |> Array.map snd
            |> Array ...
        else
            e.Errors.Value
            |> Array.map snd
            |> Array ...
    let fFail(e:OleDbQueryCompletedEventArgs<T>) = 
        e.FailedToExecuteError.Value ...
    OleDbQueryRunner.ExecuteAsync<T>(Array.empty, fSuccess, fFail)

Updates

Update 1.0.2

  • Allowed creation of column using the shortened syntax.
OleDbColumn("Table", "Field")
  • Allowed omission of the Links property when only one table is used in query.
  • Allowed creation of Access/Excel queries from string path rather than FileInfo.
  • Allowed simplified quick queries as follows:
OleDbQuery.Run<Test>()
  • Added ability to instantiate record fields with primitive types:
/// Creates a new field of type int with 1 as the default value.
[<OleDbColumn("Field", 1 :> box)>]
F1 : int
Product Compatible and additional computed target framework versions.
.NET Framework net461 is compatible.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.5.0 903 7/27/2018
1.4.0 753 7/24/2018
1.2.0 767 7/24/2018
1.1.1 789 7/24/2018
1.1.0 773 7/24/2018
1.0.2 940 3/4/2018
1.0.1 943 3/2/2018
1.0.0 900 1/31/2018