Closed parksj10 closed 1 year ago
Sure, the js part can pass multiple arguments to the .NET function if the argument is of type that can be deserialized to:
public class Template
{
public string runName { get; set; }
public string templateId { get; set; }
}
public void CreateNewRunFromTemplate(Template arg) { ... }
Ok, that's how I ended up doing it, I just didn't really want to create a class just for arguments. But if that's the only way to do it, so it shall be!
Quick question, I just learned .NET6
supports inline tuple declaration, however when I implement
public void CreateNewRunFromTemplate((string RunName, string TemplateId) newInputRun)
{
...
I get the following error:
fail: DotNetify[0]
Failed to deserialize view model property 'CreateNewRunFromTemplate': TypeConverter cannot convert from System.String.
any idea why?
Safe to say the view model deserialization logic does not yet support tuples. I may look into enhancing the logic if I can find the time, in case you want to take a stab at it, here is the place where it happens: https://github.com/dsuryd/dotNetify/blob/67f2dcca62fc6253845a1487833a50aa92c0a85e/DotNetifyLib.Core/BaseVM/VMSerializer.cs#L88
Is there any way to pass multiple arguments to a
$dispatch
call in js, writing something like the followingjs
codeTo call the following function in
.NET
: