sql server - DB connection strings in MVC applications using Entity Framework -


i working on mvc application using entity framework.

after creating edmx, noticed db connection string located in 2 places - app.config file in data class library, , web.config file in web application.

we want to:

  1. remove these 2 plain text connection strings

  2. encrypt single connection string

  3. and use our pre-existing class library decrypt connection string when needed

i tried removing 1 or other connection string config files, , db access fails. why 2 required? , there way want in mvc - ef project, , how tell ef doing?

thanks!

you can ignore connection string in ef project, think, , set connection programmatically controller.

public class somecontroller : controller {     public somecontroller()     {         /* substitute whatever method want fetch data source string here */         /* example assumes plain text web.config */         string datasource = configurationmanager             .connectionstrings["applicationservices"]             .connectionstring;         this.entities = new someentities(datasource);     }      private someentities entities { get; set; } } 

Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -