[英]Initialize in WCF Service Application Project?
I have a Library that defines some static variable such as Database address, some static method that does data formatting. 我有一个库定义了一些静态变量,如数据库地址,一些静态方法,进行数据格式化。
My WCF Service will use that library and open database connection. 我的WCF服务将使用该库并打开数据库连接。 The problem is, the static variable such as Database address in this library is not initialized, and have to initialize by reading the files on server when application start up.
问题是,此库中的静态变量(如数据库地址)未初始化,并且必须通过在应用程序启动时读取服务器上的文件进行初始化。
In ASP.NET I could initialize everything in the Global.asax's Application_Start, in Silverlight's Client side I can initialize everything in App.xml's Application_Startup. 在ASP.NET中我可以初始化Global.asax的Application_Start中的所有内容,在Silverlight的Client端我可以初始化App.xml的Application_Startup中的所有内容。 But how do I initalize in WCF Service Application Project?
但是我如何在WCF服务应用项目中初始化?
This WCF Service Application will be used with Silverlight, might contains mutiple WCF Service, if I initialize in the WCF Service constructor, then I have to do the same for every Service.... 这个WCF服务应用程序将与Silverlight一起使用,可能包含多个WCF服务,如果我在WCF服务构造函数中初始化,那么我必须对每个服务执行相同的操作....
Thanks in advance, 提前致谢,
King 王
There are multiple ways of doing this. 有多种方法可以做到这一点。 You can:
您可以:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.