C# 部分类的 ColdFusion CFC 实现?
ColdFusion 是否提供将 CFC 拆分为多个文件的机制?我不是在谈论扩展,而是在谈论将同一个 CFC 拆分为多个文件;与 C# 允许“部分”类的方式相同。这样做的原因是因为我使用 T4 生成一堆 CFC,并且我希望能够通过在另一个文件中执行此操作将功能标记到生成的 CFC 上。我想以一种不违反开闭原则的方式来做到这一点。
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 the Open-Closed Principle.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
就基本功能而言可以正常工作,但以下功能将无法正常工作:
不允许通过 javascript 调用包含的方法(所有这些情况基本上都归结为仅元数据)查看基础 cfc 中的函数等)
可能值得您在 Google 上搜索 Coldfusion Mixins 以获取有关此技术和其他相关技术的更多详细信息。
<cfinclude>
will work as far as basic functionality is concerned, however the following will not work correctly:<cfajaxproxy cfc="your.cfc">
will not allow the included methods to be called through javascript(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.
不,抱歉。恐怕是语言的限制。 CFC 是单个文件。
我的意思是,当然,你可以以某种方式破坏它。作为某种构建过程的一部分,您可以将片段包装在 cfcomponent 标记中,但我很确定这不是您在这里寻找的。
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.