开发者

Read Application.DataSource in CF9

开发者 https://www.devze.com 2023-01-26 23:59 出处:网络
How can I read the default application.datasource from 开发者_JS百科my code? A dump of application does not show me the datasource, and trying to read application.datasource gives an error.Try dumpi

How can I read the default application.datasource from 开发者_JS百科my code?

A dump of application does not show me the datasource, and trying to read application.datasource gives an error.


Try dumping application.getApplicationSettings()


Try re-start the applciation. You can't just dump application and see the datasource. But if you have this set in application.cfc it "should" be working.

component output="false" { this.name = "MyDemo"; this.datasource = "DemoDB"; }

Edit: Nice Tony I didn't know that.


The this scope in the Application.cfc only persists for the duration of the onApplicationStart(), onSessionStart() onRequestStart() etc.

If you want to expose variables, in your onApplicationStart(), simply store the in the application scope.

application.myVariable = myVariable;
0

精彩评论

暂无评论...
验证码 换一张
取 消