Exchange data into an embedded FSI session

I have an existing application in which I would like to have my own FSI session. Although, instead of a standard FSI session, I need the ability to pre-populate an FSI session with data from my application.

For example. An existing process is happening in my application. Data is created and I start an FSI session. The FSI session will be preloaded with data that has already been calculated.

Is this possible?

+4
source share
1 answer

The most correct answer for today is to use F # Compiler Services . The online service allows you to embed F # in an interactive application .

Another option:

  • You can format the data as a valid F # code and execute it in FSI, or serialize the data as a string and deserialize using F #. In this case, the article " Using FSI to execute F # code from the .NET application " Mathias Brandewinder "may be useful to you.
  • Prepare an API that provides access to your data. For example, based on MemoryMappedFile , which become available starting with .NET 4.0. Immediately after starting the FSI session, add a link to your assembly (using the FSI #r directive ) and get the data through the user API.
  • Use WCF to communicate between two processes. See answer from Phillip Trelford .
+2
source

All Articles