Search code examples
f#type-providers

Cache XMLProvider generated model(s)


Using XMLProvider from the FSharp.Data package like:

type internal MyProvider = XmlProvider<Sample = "C:\test.xml">

The test.xml file contains a total of 151,838 lines which makes up 15 types.

Working in the same project as the type declaration MyProvider is a pain, as it seems the XmlProvider is triggered everytime I hit CTRL+SPACE (Edit.CompleteWord) - and therefore regenerates all the models, which can take up to 10sec.

Is there any known work around, or setting to cache the generated models from XmlProvider?


Solution

  • I'm afraid F# Data does not currently have any caching mechanism for the inferred schema. It sounds like something that should not be too hard to add - if anyone is interested in contributing, please open an issue on GitHub to start the discussion!

    My recommendation for the time being would be to try to simplify the sample XML, so that it is shorter and contains just a few representative records of all the different kinds.