Lets explore .Net into ColdFusion. Very interesting thing which i learn as a ColdFusion beginner.
Step-1: Create web application project using Visual studio and add class as given below
(Remember ColdFusion .Net Service has to be started)
Step-2: Add assembly list into D:\ColdFusion10\cfusion\jnbridge\JBNDotNetSide.exe.config file as shown below
<assemblyList>
<assembly file="E:\Pankaj\ColdFusion\TEST\MyFirstLibrary\MyFirstLibrary\bin\Debug\MyFirstLibrary.dll"/>
</assemblyList>
Step-3: Add .cfml page and paste below code.
<cfobject type=".NET" name="Math" class="MyFirstLibrary.MyFirstClass" assembly="MyFirstLibrary.dll" >
<cfset result=Math.Add(4,4)>
<cfoutput>
#result#
</cfoutput>
<cfdump var="#Math#">
Run .cfml page into browser and check amazing thing.... result appears on your browser.
Wow....
for more details:
http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-789c.html
Step-1: Create web application project using Visual studio and add class as given below
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MyFirstLibrary
{
public class MyFirstClass
{
public int Add(int a, int b)
{
return a + b;
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MyFirstLibrary
{
public class MyFirstClass
{
public int Add(int a, int b)
{
return a + b;
}
}
}
After build application, it creates MyFirstLibrary.dll. under debug folder.
(Remember ColdFusion .Net Service has to be started)
Step-2: Add assembly list into D:\ColdFusion10\cfusion\jnbridge\JBNDotNetSide.exe.config file as shown below
<assemblyList>
<assembly file="E:\Pankaj\ColdFusion\TEST\MyFirstLibrary\MyFirstLibrary\bin\Debug\MyFirstLibrary.dll"/>
</assemblyList>
Step-3: Add .cfml page and paste below code.
<cfobject type=".NET" name="Math" class="MyFirstLibrary.MyFirstClass" assembly="MyFirstLibrary.dll" >
<cfset result=Math.Add(4,4)>
<cfoutput>
#result#
</cfoutput>
<cfdump var="#Math#">
Run .cfml page into browser and check amazing thing.... result appears on your browser.
Wow....
for more details:
http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-789c.html