How create config file in Windows Forms and add connection string to Entity Framework?
I’m using Code First Approach
How create config file in Windows Forms and add connection string to Entity Framework?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Right mouse click on your Windows Forms project -> Add new item -> Application configuration file =
App.config. Then add a connection string to the file, for example for SQL Server:Here
MyContextis the name of your derived context class (you can also name it differently if you pass that name into theDbContextconstructor).MyServeris the location of the database server, for SQL Server Express for example it is.\SQLEXPRESS. AndMyDatabaseis the name of your database.