NHibernate配置连接字符串信息 [英] NHibernate config connection string info

查看:91
本文介绍了NHibernate配置连接字符串信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

存储连接字符串信息的最佳方法是什么?

What's the best way to store connection string info?

我宁愿不只是将db密码存储在NHib.config文件中.

I'd rather not just store the db password in NHib.config file.

推荐答案

对密码和/或连接字符串使用加密,并将加密的密码/连接字符串存储在某种配置文件中.然后使用我的答案在解密后将连接字符串值添加到NHibernate Configuration对象:

Use encryption on the password and/or connection string and store the encrypted password/connection string in a config file of some sort. Then use my answer here to add the connection string value to the NHibernate Configuration object after decrypting it:

如何加载应用程序设置NHibernate.Cfg.Configuration对象?

赞:

nHibernateConfiguration.SetProperty( 
  NHibernate.Cfg.Environment.ConnectionString,
  Util.Decrypt(encryptedConnectionString)); 

这篇关于NHibernate配置连接字符串信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆