Markdig.Extensions.ScriptCs
Markdig.Extensions.ScriptCs copied to clipboard
Can I give input parameters as context?
I would like to give input objects to the ScriptCs (in new ScriptCsOptions() only ExceptionStackTrace property exists) so I can use those object's public properties, call it's public methods from the cs script...
Thinking out loud:
This is technically possible by creating a ScriptHostFactory and adding something like a Context ExpandoObject as a property on the ScriptHostFactory perhaps.
The usage would be something like:
dynamic context = new ExpandoObject();
context.aString = "Hello World";
....UseScriptCs(new ScriptCsOptions() { ExceptionStackTrace = false, Context = context })
This would mean the CSX scripts could access context objects like Context.aString.
More detail here: https://github.com/scriptcs/scriptcs/wiki/Hosting#creating-a-custom-script-host
I don't currently have any time to look at this. :)
Yes, thank you, this is exactly what I would need... I mean ExpandoObject would give very much flexibility...