0

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:

  1. string which holds all the connection string info without sensitive data
  2. string which hold a userName
  3. 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

3

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.