Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Method Factory (V4) #41

Merged
merged 2 commits into from
Oct 12, 2023
Merged

Add Method Factory (V4) #41

merged 2 commits into from
Oct 12, 2023

Conversation

marcus-j-davies
Copy link
Member

No description provided.

@marcus-j-davies
Copy link
Member Author

marcus-j-davies commented Oct 11, 2023

@spudwebb

I have added a fairly important collection of methods with this commit.

When I release the library - it's usually aligned to whatever the current schema is. But this can cause problems, if connecting to external servers that are older then what the schema is during release time of the lib (the lib is somewhat bias to the embedded runtime)

1 example is healing the network, the commands have been renamed in new schemas (I haven't yet).

But this commit allows to (during runtime).

  • Add new methods
  • Restore renamed methods

This is extremely handy to support older servers (that may use old method names), or utilise newer methods since release time.
Here is how.

var MyMethod = MethodFactory.CreateCLASS(_Driver, "node.unimplmented_method_example", typeof(MyMappedClass), "result.some.result.path");

Dictionary<string, object> Parameters = new Dictionary<string, object>();
Parameters.Add("nodeId",46)
MyMethod.Invoke(Parameters).ContinueWith((R) =>
{
   if (R.Result.Success)
   {
       MyMappedClass MyClass = R.Result.ResultPayload as MyMappedClass;
   }
});

The methods are in the MethodFactory class
I will be merging this PR into the V4 PR/Branch soon

@marcus-j-davies marcus-j-davies changed the title Add method factory Add Method Factory (V4) Oct 11, 2023
@marcus-j-davies marcus-j-davies merged commit d576bb6 into 4.0.0 Oct 12, 2023
1 check passed
@marcus-j-davies marcus-j-davies deleted the Add-method-factory branch October 12, 2023 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant