winforms - How do I encrypt the connection string with EF 4.1 Code First? -


I am using RC before code to create class library and I would like to be able to encrypt the connection string I am using Class libraries can be ASP.NET or Windows Forms apps, so I need an encryption method that works with both.

It appears that I can pass DbContext with a name in a connection string, but not as the value, as shown, so I do not think that before I pass the string with Dabantax Can decrypt my program manually. Could anyone point me in the right direction?

You can easily encrypt any .NET configuration section - only in ASP.NET No, as many D

with this topic, you & lt; Connection setting & gt; Can encrypt > Sections - and to make it still easier, you can also exclude that section from external form in a separate file.

Then for your Winforms app in your app.config , you want to:

  & lt; ConnectionStrings configSource = "ConnectionStrings.config" />   

and it will be in your web.config for your web application, and only and lt; ConnectionStrings & gt; and it can be encrypted Load the correct connection string from your configuration, and pass it to your DbContext constructor, and you should be ok.

Comments