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:
remove these 2 plain text connection strings
encrypt single connection string
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
Post a Comment