Type providers lets you code up a kind of 'shim library' that knows about some kind of data entity (e.g. a spreadsheet) and use that library as part of the compiler/IDE toolchain so that you can write code likemySpreadsheet.ByRowAndColumn.C4之类的东西,并获得Intellisense(自动完成)和工具提示(例如,将单元格C4描述为Bob的Salary)和静态类型输入(例如,使其为双精度型或字符串型或其他类型).从本质上讲,这为您提供了静态类型对象模型的工具能力,并利用了各种动态或代码生成系统的易用性,并且在两者上均进行了一些改进. 成本"是某人必须编写填充程序库(类型提供程序"),但是许多此类提供程序非常通用(例如,会讲OData或Excel或WMI或诸如此类的东西),因此一小部分类型提供程序库借助静态类型和一流的工具支持,以您的编程语言提供全球大量数据.or something, and get Intellisense (autocompletion) and tooltips (e.g. describing cell C4 as Salary for Bob) and static typing (e.g. have it be a double or a string or whatever it is). Essentially this gives you the tooling affordances of statically-typed object models with the ease-of-use leverage of various dynamic or code-generation systems, with some improvements on both. The 'cost' is that someone has to write the shim library (the 'type provider'), but many such providers are very general (e.g. one that speaks OData or Excel or WMI or whatnot) and so a small handful of type provider libraries makes vast quantities of the world's data available in your programming language with static typing and first-class tooling support.该体系结构是一个开放的编译器,提供程序的作者可以实现一个小的接口,该接口允许他们将新的名称/类型注入到编程上下文中.类型提供程序可能只是传递给编译器的另一个库(项目中的引用,-r -ed),带有额外的元数据,将其标记为参与开发的编译/IDE/代码生成部分的类型提供程序.The architecture is an open compiler, where provider-authors implement a small interface that allows them to inject new names/types into the programming context. A type provider might be just another library you pass to the compiler (a reference in your project, -r-ed), with extra metadata that marks it as a type provider that participates in the compilation/IDE/codegen portions of development.我不完全了解您的xml示例中的自定义映射器"是用来进行比较的.I don't know exactly what a "custom mapper" is in your xml example to draw a comparison. 这篇关于F#类型提供程序,它们如何工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
09-06 02:09