Net Gateway How to instantiate a Class with a Constructor with a parameter
I have been trying to get to grips with the new dot Net Gateway used in IRIS as the import of the DLL to construct proxy classes is no longer supported in IRIS I have a third party DLL that when I try to instantiate throws an error complaining about the class not instantiated as it does not support parameterless constructor .I am using this new
set gateway = $system.external.getDotNetGateway()
do gateway.addToPath(myPath_"\DotNetGatewaySamples.dll")
I would like then to instantiate my class which has a constructor that requires a parameter, how am I suppose to achieve that and if there is a documentation that explains this in depth that I missed please direct me to it thank you. This is what I have tried and it compiles with errors
set remoteObj=gateway.new("parametisedClass(theparameter)")Comments
Try with:
Set remoteObj=gateway.new("parametisedClass",theparameter)
For additional info, my suggestion is to look at samples-dynamicgateway-dotnet in GitHub.
@Enrico Parisi
I have tried calling it that I get
<THROW>%Constructor+33^%Net.Remote.Object.1 *%Net.Remote.Exception <GATEWAY> System.Reflection.TargetInvocationException Exception has been thrown by the target of an invocation.Are you sure you are using the correct/full name reference to your parametisedClass?
It should be NamespaceName.PublicClassName
@Enrico Parisi
I am sure not sure what the whole error is about but the Constructor key word says it all
You can enable the log in the .NET Gateway and see if the log give you some useful info.
As in my previous post, my guess is that you are passing the wrong/incomplete class name as 1st parameter of new().