454851 (2) [Avatar] Offline
#1
I've just finished the section on Type Providers and found it a very interesting concept that I'm eager to explore in my own projects. I just wondered if there are any plans to add sections on transforming data and writing it back out to a new file?
Isaac Abraham (53) [Avatar] Offline
#2
Hi

Not especially. The reasons behind this are two-fold: -

1. Most Type Providers don't contain support for write operations. Some do (for examples, the Azure Storage TP allows Table write operations once it's inferred the schema based on existing data and the SQL TPs both perform write operations) - but the majority don't.

2. Because of the erasing nature of type providers, they're difficult to work with reflection-based tools. For example, it's not especially easy to move data from a JSON file that has been parsed using FSharp.Data into Newtonsoft.JSON directly.

There's of course nothing to stop you defining a formal type e.g. a record which represents the output format, and then manually mapping between the provider type and the record structure. This is not so different from what we do in the Capstone exercise where we "expose" data over ASP .NET Web API sourced from a Type Provider.

I might put a little "box out" for this somewhere in the TP section as it's a fair question.

Thanks!
454851 (2) [Avatar] Offline
#3
Thanks for the swift response smilie