Link to home
Start Free TrialLog in
Avatar of Howard Bash
Howard BashFlag for United States of America

asked on

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?  
ASKER CERTIFIED SOLUTION
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Howard Bash

ASKER

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?


I think you can only use types which can be marshalled between the coldfusion and .NET. Does ColdFusion support enums?
"Does ColdFusion support enums?"  ... Does Coldfusion support .NET Enums.
Also, does it support properties,  shared classes,  etc. ?
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.
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.
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.  
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.
(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

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.
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.  
.. It's a bit of a pain. But unloading/reloading isn't something I normally need to do in a prod environment, only development.
How about stopping and starting the Cold Fusion 8 .NET Service programmatically from within CF?
Is that possible?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial