Using generated C# with Formula API equivalents of the Formula commands

Nov 24, 2013 at 9:25 PM
The Formula "generate" command prints a C# program.

Now what?

I suspect that we should be able to use this generated C# program and perform the equivalent of the Formula commands using the C# Formula API instead.

For example, what would be the API equivalent of the Formula command "query <model> <goals>"?

It would be useful to have an optional file parameter on the "generate" command to save the C# program to a file and document the API equivalent of the Formula commands.
  • Nicolas.
Dec 17, 2013 at 11:17 PM
The "generate" command shows you a C# embedding of the Formula domain, but it's not particularly useful. Really what you want to do is use this generated code within a C# project to import / export Formula models as C# data structures. This feature is supported and a small test project can be found under Tst\Tests\API\LittleFuncLang\LittleFuncLang.sln. This test shows how to create a project that automatically generates C# data structures from a Formula specification, and then imports and exports models using these data structures.