문제

I have looked through a number of Type Provider samples and videos and have always seen them to be read-only. My questions: Are Type providers always read-only or can they also provide write access? Is there an example for providing/using write access?

도움이 되었습니까?

해결책

As mentioned by John, the standard SQL type provider allows you to create new entities and store them in the database and there are no theoretical reasons why this would not be possible (you can emit mutable properties).

The F# Data type providers are generally read only, but an older version of the document (JSON, XML, ...) used to emit mutable properties, so you could modify JSON and XML files. You can have a look at the samples in tests here. The same branch also includes source code for the provider implementation (if you wanted to have a look at that).

I think that the problem with write API is that it is quite difficult to design. For some of the discussions about this, see this discussion and the FSharpX issues linked from there.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top