FSharpx.TypeProviders.Sample:
The FSharpx.TypeProviders.Sample package provides an example of how to consume the custom type providers included in the FSharpx.TypeProviders library. The package adds a Test.config file as well as a F# source file that contains example code for using the TypedAppSettings type provider.
FSharpx.TypeProviders.DslSample:
The FSharpx.TypeProviders.DslSample package makes it easy to quickly get started with authoring a custom type provider. The package adds a F# source file that contains the source for a very simple custom type provider, a F# script file that can be used to test the custom type provider, and a batch file that makes it easy to do manual test/debug activities.
You may be curious about the commands in the batch file and why they are needed. Section 5.6 of the document on Writing F# 3.0 Type Providers that was provided by the F# team on 09/24/2011 includes development tips that make this more clear:
5.6.1 Run Two Visual Studio Instances. You can use one Visual Studio to develop the type provider. You can test it in another, since the test IDE will take a lock on the DLL preventing it being rebuilt. Thus, the second instance of Visual Studio must be closed while the provider is built in the first instance, and then reopened.
5.6.2 Debug type providers by using invocations of fsc.exe. Type providers are invoked by
- fsc.exe (The F# Command Line compiler)
- fsi.exe (The F# Interactive compiler)
- devenv.exe (Visual Studio)
Debugging type providers can often be easiest using fsc.exe on a test script file (e.g. script.fsx). This is because
- You can launch debug using a command-line prompt devenv /debugexe fsc.exe script.fsx - You can use print-to-stdout logging
I have tried both approaches and agree that the second is definitely the easiest. The .fsx and .bat files provided in this NuGet package make this approach even easier. Simply modify the code of the type provider, then test/debug by launching the batch file. Note: If/when changes to the Test.fsx file are required, it is recommended that these changes be made in an editor outside of Visual Studio.
No comments:
Post a Comment