Hello,
I’m having some issues working with known types.
I have created a known type which is really basic
public class Custom
{
public static string ShowMe { get {return "ShowThat"; } }
public static string DoSomething() { return "DoSomething"; }
}
and added it to the engine like documented
engine.KnownTypes.Add(typeof(Custom));
Now we face some limitations because for this to work, the property and method needs to be static, which is probably for a reason. Our need would be to get data from an outside source by calling a service that needs to be injected into the known type class. Having the limitation of static property/method is not possible with static typing. Is there a reason why this need to be static? Is there a way to do what we need to achieve? Example below of what we need to perform:
public class Custom
{
private readonly IKernelProvider kernelProvider;
public Custom(IKernelProvider kernelProvider)
{
this.kernelProvider = kernelProvider;
}
public string ShowMe { get {return kernelProvider.GetSomeValue(); } }
public string DoSomething() { return kernelProvider.GetSomeValue(); }
}