-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Help needed to write a console app with states and data stored. #313
Comments
Hi @KySpace There are different approaches to this and what's best suited for your app will depend on its needs. Can you share more about what your app is doing? What commands are passing and receiving state and is the state a complex object? |
My app has the core part written in F#. I have a class (let's call it inner) that at its core, is a property that records a parsing result of a file (or a part of the file), that is not exposed to C# code. |
The way console commands work is that each time you run a command, it's in a new process. Even when you pipe the result of one command to another, both commands are run in different processes. One way around this is to serialize the state to file and deserialize it for the next command. If you want to pipe commands, then the output of the first command would be the filename. Another way around this is to create a REPL session (read-evaluate-print-loop). An example is when you type We don't have out-of-the-box support for REPL sessions yet. We have a proof-of-concept in PR #306. You could pull the middleware classes into your app and use them to enter a session and reference the shared state. The final option is to use Powershell or cs-script to define your commands within a shell that can store object state. |
I see. I'll give these methods a try. At least I learned a lot. |
I am new to writing console apps. This amazing tool is a great way for parsing and structuring commands, but if I want to store the state or data in a property, how should I do that?
I see that every time I call
AppRunner.Run()
, I am constructing a new instance to the app class. Is there a standard practice to let the latter command utilize the result of the former one?Thanks!
The text was updated successfully, but these errors were encountered: