如何在没有App.Config的实体框架中将连接字符串放在我的应用程序中 [英] How Do I Put Connection String In My Application Without App.Config In Entity Framework

查看:89
本文介绍了如何在没有App.Config的实体框架中将连接字符串放在我的应用程序中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在实体框架中没有app.config的情况下将连接字符串放在我的应用程序中

帮助我plz

how do i put connection string in my application without app.config in entity framework
help me plz

推荐答案

你可能很难 - 编码。我不会,但你可以。
You could hard-code it. I wouldn't, but you could.


如果你想避免app.config的原因是你想隐藏连接(或其他敏感)信息,那么你可以加密命名部分。



请参阅:加密命名配置文件部分 [ ^ ]



和示例:加密/解密配置文件部分 [ ^ ]



如果您的应用程序是从IIS运行的Web应用程序,那么您可以完全加密web.config文件。 BR />


请参阅: web.config的aspnet_regiis加密 [ ^ ]

我用过这个。它有效,但我无法保证命名段加密;你只需要吮吸它看看。
If the reason you want to avoid app.config is that you want to hide connection (or other sensitive) information from prying eyes then you can encrypt named sections.

See: Encrypt named config file section[^]

and example at: Encrypt/Decrypt Config file sections[^]

If your application is a web app run from IIS then you can encrypt the web.config file completely.

See: aspnet_regiis encryption of web.config[^]
I've used this. It works, but I can't vouch for the named section encryption; you'll just have to suck it and see.


正如解决方案1中所提到的,它需要在某个地方。无论是硬编码还是某种文件。最好的选择是app.config。
As mentioned in Solution 1, it needs to be somewhere. Either hard coded or in some sort of file somewhere. The best option is the app.config.


这篇关于如何在没有App.Config的实体框架中将连接字符串放在我的应用程序中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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