Method Implementation - LinkModelToNode

Questions regarding the use of the .NET SDK 2.0 for Server or Client development or integration into customer products ...

Moderator: uasdknet

Post Reply
pfay
Sr. Member
Sr. Member
Posts: 12
Joined: 10 Dec 2013, 11:52

Method Implementation - LinkModelToNode

Post by pfay »

Hi,

I am trying to add method implementation logic behind my methods. When using simple types I can successfully add implementation logic, however when using more complex types with compositional aggregation relationships (objects within an object) I am having difficulties.

Example:
- Parent Object
- Parent Property
- Parent Method()
- Child Object
- Child Property
- Child Method()

When I add method implementation to the parent object only, LinkModelToNode(NodeId(ParentInstance), ParentMethodModel, ....) then its method implementation executes successfully. However if I also try to link method implementation to the child instance then the parent implementation logic fails to execute, LinkModelToNode(NodeId(ChildInstance), ChildMethodModel, ....).

What is the correct approach for adding method implementation for objects within objects?

User avatar
Support Team
Hero Member
Hero Member
Posts: 3068
Joined: 18 Mar 2011, 15:09

Re: Method Implementation - LinkModelToNode

Post by Support Team »

Hello,

There is an issue with the mapper and methods.
You need to call LinkModelToNode once for each sub-object.

Code: Select all

m_serverObject.Configuration.ModelHandle = m_rootNodeManager.LinkModelToNode(ObjectIds.ServerConfiguration, m_serverObject.Configuration, null, null, 1000);
m_serverObject.Configuration.ServerConfigurationMethods = this;

m_serverObject.Configuration.ModelHandle = m_rootNodeManager.LinkModelToNode(ObjectIds.ServerConfiguration_TrustList, m_serverObject.Configuration.TrustList, null, null, 1000);
m_serverObject.Configuration.TrustList.FileMethods = m_serverObject.Configuration.TrustList;
Best regards
Support Team

maix
Jr. Member
Jr. Member
Posts: 1
Joined: 22 Jan 2019, 08:39

Re: Method Implementation - LinkModelToNode

Post by maix »

Hi,

has this problem been fixed in the meantime? I came across the same problem and found this post from 2014. Calling LinkModeltoNode for all child objects can be really annoying if you have lots of nested objects... I understand that this was a bug in 2014, but hasn't it been fixed until now? Or is there some other way how to set up methods for objects including all nested childs.

Thanks

Post Reply