Skip to main content

Database deployment

In past it has been a pain for developers to deploy a database driven application. You had to go through a list of SQL scripts to create tables and other database objects.

In ASP.Net 2.0, you can copy the .mdf file in \APP_DATA folder. Then XCOPY the entire application folder on the web server. Following one line of code in web.config will attach the database for you.


connectionString =" Data Source =.\SQLExpress;AttachDbFile=|DataDirectory|\ASPNETDB.MDF;Database =dbASPNETDB.MDF; User Instance=True; Trusted_Connection = Yes;"

The above connection string assumes you have an instance of SQL Server called SQLExpress running on you local machine.
ASPNETDB.MDF is available in APP_DATA folder. ASPNET is trusted user.

Comments

Popular posts from this blog

Why there is semicolon at the start of a JavaScript function?

Very often while reviewing the code for my team, I will come across a semicolon at the start of JavaScript function as show below ; (function () { 'use strict'; ...and I often wondered what purpose it served. Guess what. It is an insurance to make sure your script works fine when all other scripts are merged together;  The leading ; in front of immediately-invoked function expressions (iffe) is there to prevent errors when appending the file during concatenation to a file containing an expression not properly terminated with a ;. So there you go. Now you know what that little semicolon is doing there in your code.

What is Event Sourcing?

If you scratching your head and wondering what is Event Sourcing, this is a very good article to start. https://www.erikheemskerk.nl/event-sourcing-awesome-powerful-different/ I couldn't have explained it any better.