add intial draft to Wiring Console.Waterworks into your proj.

master
Craig Oates 5 years ago
parent
commit
d2216cf0e0
  1. 58
      Wiring-Console.Waterworks-into-Your-Project.md

58
Wiring-Console.Waterworks-into-Your-Project.md

@ -0,0 +1,58 @@
This section assumes you have already created an F# console project. It, also, assumes you have added the appropriate Console.Waterworks (C.W.) version to it. If you have not and are unsure on how to do this, please refer to the following link;
- [Adding Console.Waterworks to Your Project]( of your hands, it requires your project to look a certain way. The first thing you need to do is create a file called "ConsoleCommands.fs". When you have done that, to create a name-space called `Commands` and a module called `ConsoleCommands` within it. Whilst you are still in "ConsoleCommands.fs", add "open Console.Waterworks" to the module. If you are writing a .Net Core program, add `open Console.Waterworks.Core` statement in its place. Once that is set-up, add a function called `test`. You should end up with something which looks like this;
### .Net Version
This code resides in ConsoleCommands.fs, in the BrittleFish project.
```f#
namespace Commands
module ConsoleCommands
open Console.Waterworks
let test () = "You have set-up Console.Waterworks"
```
### .Net Core Version
This code resides in ConsoleCommands.fs, in the BrittleFishCore project.
```f#
namespace Commands
module ConsoleCommands
open Console.Waterworks
let test () = "You have set-up Console.Waterworks"
```
With `ConsoleCommands` set-up, head back to "program.fs". We can now tell C.W. where to look for your `business logic`. To do this, add the following code to `main`;
```f#
let liaison = new CW_Liaison()
liaison.run("Commands", true)
```
As an aside, you can name the "ConsoleCommands.fs" file anything you like. This is because the `CW_liaison` object looks for the name-space of the `ConsoleCommands` **class**. The name of the file is actually irrelevant. It is, also, important to note the `ConsoleCommands` module. Underneath the covers, C.W. looks for a static **class** called `ConsoleCommands`. Luckily, C.W. recognises F#'s modules as static classes so we can use them instead -- because F#'s "classes" are a bit clunky.
With everything set-up, you can now run the program. When you do, it will await your input. If you type "test" into the prompt and press ENTER, you should see  "You have set-up Console.Waterworks". And with that, you are ready to start building out your "business logic".
SCREENSHOT OF CONSOLE WORKING.
If you change `false` to `true` in the `run` method (in `main`), the programs assembly information will appear at run-time.
SCREENSHOT OF ASSEMBLY INFO SHOWING AT RUN-TIME.
## Changing the Assembly Information for you Console Program
To change your console program's assembly information, you need to alter its "Assemblyinfo.fs" file. There are several ways to do this and it differs between the tradition .Net and .Net Core versions.
### .Net
Need to create an assembly info file if one does not exist...
### .Net Core
One way to change the assembly information in your .Net Core program is to alter it via the properties menu...
THIS IS NOT FINISHED.
Loading…
Cancel
Save