What happens when type providers change in F #?

After watching channel 9 videos on F # type providers, I’m interested in learning about data schema changes. Don touched on this a bit at the end, but I'm looking for details.

  • The demo showed that you really click ".". to find out what data is available to you. After you connect, say, the crime rate in the USA in 2008, what happens when you distribute your application and circuit changes? Are you getting runtime errors? Responsibility for these errors lies with the developer?

  • Also, is this the responsibility of the types supplier?

    Currently, when you download a .NET assembly, you know that it will never change until you (manually or through a service) explicitly update it. Compilation errors from evolving types must be resolved, but you can always pause the update until you are ready to change. With type providers, should you program more carefully against them?

+7
source share
1 answer

The supplier of the type is responsible for the changes to the schema, but only at design time. After developing the application, it compiles using the type provider and uses the current schema at compile time.

When you use the type provider from Visual Studio, it can track schema changes and notify Visual Studio that the schema has changed. I wrote an example XML type provider that does this, so when you change the schema (the XML file used as an example), you will immediately get errors in VS. I did a video demonstration of this (around 19:40).

After compiling your program, the type provider generates code that should be used in compiled form (and the type provider is not used at run time). This means that if the circuit changes at runtime, you can do nothing about it (the developer needs to respond). If changing the schema is backward compatible (i.e. add new columns to the database table), then your program can still work fine.

+8
source

All Articles