Data access layer with F#
The F# type provider feature gives the flexibility to access different types of data, such as databases, structured types (that is, JSON, XML, CSV, HTML) and web-scale data.
First, let's look at data access resources.
CSV, HTML, JSON, and XML data
In F# applications and scripts, FSharp.Data.dll
is used to implement the functionality to access data. It is also useful for structured file formats such as JSON, XML and for consuming freebase services. A sample document structure is used for type safe access to the document; it works as a type provider, like the CSV type provider takes a CSV sample as input and creates a column format data for that sample.
Providers
F# supports different types of provider, such as:
HtmlProvider<>
JsonProvider<>
XmlProvider<>
WorldBankDataProvider<>
CsvProvider<>
Let's discuss one of them, for example, the CSV type provider. The FSharp.Data
NuGet package contains CsvProvider
. We can pass a .csv
file and can read other...