Notice: With the launch of Adobe Cookbooks, this site will no longer be accepting new entries or posting new content. Thanks to everyone who submitted content!

How can I access/call functions in .Net classes?

As per the ColdFusion documentation, the <cfobject> tag can be used to access and use .Net classes inside of your CFML code.

<cfobject
type = ".NET"
name = "myInstance"
class = "myDotNetClass"
assembly = "C:/Net/Assemblies/dotNetClass.dll">


<!--- Call a method--->
<cfset myVar = myInstance.myDotNetClass(5)>


This question was written by Jeremy Petersen.
It was last updated on December 19, 2007 at 10:54:05 AM EST.

CFML Referenced

<cfobject>

Categories

Miscellaneous

Comments

Comment made by James Wood on February 5, 2008 at 5:57 PM
I can't seem to be able to get the class to work unless the .NET connectionString is hardcoded. All the classes that have already been created use string connectionString = ConfigurationManager.AppSettings["sqlDatabaseServer"];

Is there something that I am missing?