Search code examples
c#.netcoldfusion

Calling .Net function asking for System.Type parameter in ColdFusion


I am attempting to integrate with the Xero API via a C# Library in my ColdFusion site. I have managed to create a few different objects using

createObject(".net","Xero.<i>class</i>","XeroAPI.DLL")

and have managed to make a few calls against the different objects, however I'm having an issue with one of the calls. Doing a cfdump on the repository object shows a function called

UpdateOrCreate__1(System.Type, XeroApi.Model.ModelBase)

which is used as a generic function for uploading data to Xero. I have managed to create the object that I want to upload fine, however I'm not sure what to put in the System.Type parameter. I assumed it would just be a string or something similar defining the class of the object, however when I try this

oXeroRepository.UpdateOrCreate__1("XeroApi.Model.Employee",oXeroEmployee);

I get the error

Either there are no methods with the specified method name and argument types or the UpdateOrCreate__1 method is overloaded with argument types that ColdFusion cannot decipher reliably. ColdFusion found 0 methods that match the provided arguments

Any help would be appreciated.


Solution

  • After searching through many pages on the web I noticed a function on one of the code examples called getDotNetClass(). Calling this function on the .Net object I was passing up to the C# library did the trick.