After watching Channel 9's video on F# Type Providers, I'm wondering about data schema changes. Don touched on this a little bit at the end, but I'm looking for more details.
The demo made it look as though you're essentially pressing '.' to explore what kinds of data is available to you. After you link up to, say, crime rates in the US in 2008, what happens when you distribute your application and the schema changes? Do you get runtime type errors? Is it the responsibility of the developer to handle these errors?
Also, does this put the responsibility into the type provider's hands?
Currently when you download a .NET assembly, you know it will never change until you (manually or through a service) explicitly update it. Compile errors from evolving types must be resolved, but you can always hold off the upgrade until you're ready for the change. With type providers, do you have to program more cautiously against them?
Responding to the schema changes is the responsibility of the type provider, but only at the development time. Once you develop an application, it gets compiled using the type provider and using the current schema at the time of the compilation.
When you're using type provider from Visual Studio, it can monitor the schema changes and notify the Visual Studio IDE that there has been a change in the schema. I wrote a XML type provider example that does this, so when you change the schema (XML file used as an example), you'll immediately get errors in VS. I did a video demonstration of this (around 19:40).
Once you compile your program, the type provider generates code that should be used in the compiled form (and the type provider is not used at runtime). This means that if the schema changes at runtime, you can't do anything about it (the developer needs to react). If the schema change is backwards-compatible (i.e. add new columns to a DB table), then your program may still work fine though.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With