c# - Change connection string without rebuild -


Generally, projects are created using the methods given below:

1 DAL class Create a solution together (this is a DBML file). Create a second class project called BLL which is a professional level that creates CRUD operations. Finally, an ASP Net project.

The first thing I do is in DAL (Data Access Layer), I create a connection to the database and drag the necessary tables. I prepare code for receiving, editing, and data in the BLL project. Me asp A connection string must be added to the net project so that it can connect to the database.

I always have to face this problem when I run the project on a test server, then I am ASP. Net Web Project Config Connection String is easy, but for the first time on application brakes (STL can not connect to database) such as DAL is still seeing the original connection string. So what I have to do, the new connection string is set in the DAL project and it copies it, after which everything allows to work.

I am going from a test server to a live server. I've read about using config files, but I think it can be used ..... But there must definitely be an easy way, without re-compiling my DAL DLL, the connection string is a Change in place?

Am I not a mistake or can I use it to take advantage of it?

If you do not want to use 2 connection string (your UI. Second on your data access) and you do not want to rely on a specific database (in this case SQL Server), then you simply have a single connection string on your web.config UI.

When you do this, on your DA, just use DLL Microsoft.Practices.Enterprise.Data so that you do not depend on the SQL for connection.

The next time, when you want to migrate your application, for example, from SQL to Oracle, because you are no longer using SQLConnection, you only change your connection string and its completion Are you Your stay in Oracle was done in 1 minute.


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -