I'm using EF 6.1 Code-First.
Currently my DbContext class look like:
public class StylishBlogDB : DbContext
{
/// <summary>
/// Initializes a new instance of the StylishBlogDB class.
/// </summary>
public StylishBlogDB()
: base("name=StylishBlogEF")
{
}
}
StylishBlogEF ConnectionString is located in my app.config file and with the login info (user and password).
I'm planning to remove my sensitive data from the connection string and get it from the user when my application being launched.
I developed a login form in WPF which takes all the needed info from the user.
My form contains TextBox for user name and PasswordBox for password so it returns as an output two parameters: a string which hold user name and SecureString which keep the password.
So my question is:
How can I build a connection string from all the following parts:
- string which holds all the connection string info without sensitive data
- string which hold a userName
- SecureString which holds a password
and send it as input parameter to StylishBlogDB class (inherits from DbContext)?
BTW - I'm using .Net framework 4.5