Accessing Data with F# Type Providers

Learn how to easily process XML documents and call JSON-based REST services using F# type providers, how to package your F# code into a reusable .NET library, and how to integrate it into a C# ASP.NET application.

Course info

Rating

(78)

Level

Beginner

Updated

Nov 3, 2015

Duration

2h 14m

Description

Modern applications need to access data from a variety of external data sources, including XML, SQL, and JSON-based services. In this course, we look at F# type providers. With type providers, you can easily explore and access a wide range of data sources directly from your code editor. We start by learning about type providers using the F# interactive and then we demonstrate how you can integrate data access code written in F# as part of a larger C# ASP.NET project.

About the author

Tomas is an open-source developer, book author, and computer scientist. He works on F# libraries for data-science and offers training and consulting services at fsharpWorks.

Section Introduction Transcripts

Section Introduction Transcripts

F# Type Providers and Data ExplorationHello. My name is Tomas Petricek, and this is the Accessing Data with Type Providers course, Module One, F#, Type Providers, and Data Exploration. Do you find F# interesting, but are you still waiting for a good way to use it in your project? Do you find F# interesting, but are you looking for a convincing use case that you could use to sell F# to your colleagues? In this course, we'll learn how to use F# for data access in a larger. NET application, which is a good answer to both of these questions. The usual way to access XML data from C# is to use LINQ to XML and the XDocument type. So this example lists the latest movies from Netflix, but did it ever happen to you that your application was throwing an exception because you mistyped one of the element names? Or did you ever have to go through the complicated process of calling a JSON-based REST API? You have to go to the documentation for the endpoint you want to call. This gives you a sample JSON response. If you're using Json. NET, you have to take that sample JSON, turn it into C# classes, you have to make sure that all your properties are named correctly and don't contain any typos, and if you're accessing large REST API, this is a lot of boilerplate code that you have to write. Data access problems can be solved nicely with F# type providers, but this doesn't mean that you have to use F# for everything. F# data access library can work nicely with user interface implemented in C#, and that's exactly what we're going to do in this course.