ColdFusion 8 and DOTNET (Visual Studio 2008)

I am trying to use a class library compiled to a dll in a cold fusion page.  I can access some of the public functions, but others come back with a not found error.

Also,  how do I use an enumeration from the class library in cold fusion and in general  are there any tutorials/blogs/urls that offer guidance into how to interface Cold Fusion with DOT NET DLLs?  
LVL 1
Howard BashSenior Software EngineerAsked:
Who is Participating?
 
Howard BashSenior Software EngineerAuthor Commented:
All these examples are very basic (no pun intended).  None of them address how to use class properties and their accessability.  Can I use enumerations from my class library/dll?  Can I returned my own class objects?


0
 
CodeCruiserCommented:
I think you can only use types which can be marshalled between the coldfusion and .NET. Does ColdFusion support enums?
0
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

 
Howard BashSenior Software EngineerAuthor Commented:
"Does ColdFusion support enums?"  ... Does Coldfusion support .NET Enums.
Also, does it support properties,  shared classes,  etc. ?
0
 
Howard BashSenior Software EngineerAuthor Commented:
Here is my latest result.  It seems (by experiment) that if I pass an integer to my DOTNET DLL function, which expects an enumeration value (also an integer of value 1) it fails.  However,  if I instead have a function that takes an integer as a parameter instead of the enum, coldfusion works.

It's a bit surprising that it has this problem, as under the hood the enum values are of type integer.
0
 
CodeCruiserCommented:
But the type of the parameter has to match even though its int under the hood. Can you not use integer instead? I know enum is more readable but if ColdFusion is unable to use it then you have no option.
0
 
Howard BashSenior Software EngineerAuthor Commented:
Sure I can use integers.   It's unfortunate though in several ways.  First, although the enumerations are all of type integer and yet CF kicks out for them.  Secondly,  the intellisense that I give up when I replace the enums as just integers is a loss for development and readability.

For example if I have an enum as follows:
Public Enum DataConnectionStrings
  ProductionString=1
  DevelopmentString=2
End Enum

Then a function definition:
Public Function GetConnectionString(whichConnection as DataConnectionString) as string
   select case whichConnection
     case ProductionString
        return "Prod Info"
     case DevelopmentString
        return "Dev Info"
   end select
End Function

As you see this self documents nicely.  
0
 
Howard BashSenior Software EngineerAuthor Commented:
Also,  it appears that CF cannot "see" public properties.  I really need a list of the various interactions allowable between CF and .NET.

Public Functions - yes
Public Properties - no
etc....

And an example of what is possible would be great as well.
0
 
_agx_Commented:
(no points ...)

I really need a list of the various interactions allowable between CF and .NET.

Silly question but have you checked the documentation on .net integration? It's not extensive, but does touch on some of the questions you've mentioned liked enums and properties.  IIRC

* implicit _conversion_ of enums are not supported
* public properties are supported using get_propertyName() / set_propertyName()  AND
* public functions should be supported


http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSc3ff6d0ea77859461172e0811cbec22c24-789e.html

0
 
Howard BashSenior Software EngineerAuthor Commented:
There is a good amount of information in the URL you specified above.  However,  is there a way to have cold fusion unload the dll?  While developing the dll,  I can stop and start the cold fusion .net service and that works.  But this is only good for development.
0
 
_agx_Commented:
Unfortunately not that I know of.  Java jars work the same way.  AFAIK once the dll/jar is loaded into memory, a stop/start is the only way to unload it / or load a newer version.  
0
 
_agx_Commented:
.. It's a bit of a pain. But unloading/reloading isn't something I normally need to do in a prod environment, only development.
0
 
Howard BashSenior Software EngineerAuthor Commented:
How about stopping and starting the Cold Fusion 8 .NET Service programmatically from within CF?
Is that possible?
0
 
_agx_Commented:
That's possible.  All you need is a .bat file that calls "net stop" or "net start".  

example bat file:
============
net stop "ColdFusion 9 .NET Service"

Then call the bat file with cfexecute:

<cfexecute name="c:\fullPathTo\yourBatFile.bat" .... />

The only possible hitch is permissions. The windows account CF is running under must have permission to use net start/stop.  
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.