将连接字符串存储在 WCF 数据服务的服务配置中
我有一个类库项目,其中包含指向 SQL Azure 数据库的 EF 模型。我还有另一个 Azure WCF Web 角色项目,其中包含 WCF 数据服务,将 SQL Azure DB 中的数据公开为 OData 服务。现在,我将连接字符串存储在 WCF Web 角色项目的 web.config 中。
我想做的是将其作为配置,因此将其移至服务配置文件,以便我可以在必要时更改连接字符串(将其放在 web.config 中似乎是短视的)。
我遇到的问题是如何连接 OData 服务以不使用 web.config 连接字符串,而是使用配置中的连接字符串。
I've got one class library project that contains an EF model that points to a SQL Azure database. I also have another Azure WCF Web Role project that contains a WCF Data Service exposing the data in my SQL Azure DB as a OData service. Right now I have the connection string stored in the web.config of the WCF Web Role project.
What I'd like to do is make this a configuration, so move it over to the service configuration files so I can change the connection string if necessary (putting it in the web.config seems shortsighted).
The problem I'm having is how to wire the OData service up to not use the web.config connection string but instead use one from the configuration.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
???
???