ColdFusion CFC implementation of C# Partial Class?
Does ColdFusion offer a mechanism for splitting CFCs into multiple files? I am NOT talking about extension, I am talking about splitting the SAME CFC into multiple files; the same way C# allows for "partial" classes. The reason for this is because I am using T4 to generate a bunch of CFCs and I want to be able to tag functionality onto the generated CFC by doing so in another file. I want to do this in a way that doesn't violate开发者_StackOverflow the Open-Closed Principle.
<cfinclude>
will work as far as basic functionality is concerned, however the following will not work correctly:
- Metadata functions - only the functions within the inspect CFC will be shown - not the cfincluded functions
<cfajaxproxy cfc="your.cfc">
will not allow the included methods to be called through javascript- Calling included functions as a web service call will not be possible
(all these cases basically boild down to the metadata only seeing the functions etc. which are within the base cfc)
It might be worth you googling Coldfusion Mixins for more detail on this and other related techniques.
No, sorry. A limitation of the language, I'm afraid. A CFC is a single file.
I mean, of course, you could bastardize it somehow. You could have fragments that are wrapped in a cfcomponent tag as part of some kind of build process, but I'm pretty sure that's not what you're looking for here.
精彩评论