In many organizations, the .Net developer is also tasked with the coding and creation of the database to hold their application data. Often they need to take over projects for which no database code can be found. Then once they've created code, they have to track changes manually in order to provide the DBA with change scripts. All the while thinking, "there's got to be a better way!" Fear not .Net Developer, it's Data Dude to the rescue! Originally code named "Data Dude", Visual Studio Database Projects havef gone through several name changes since it's inception with VS 2005. In Visual Studio 2010 it became another project type, a Database Project. In this series you will learn how to harness the power of the Database Project to create a new database, or reverse engineer the code for an existing database. You will learn how to refactor, and let Visual Studio keep track of the changes, to let it automatically generate change and deployment scripts. Finally, you'll learn how to take advantage of Visual Studio's powerful data generation capabilities to create realistic test data.
Robert C. Cain (arcanecode.com) is a Microsoft MVP, MCTS Certified in BI, and is the owner of Arcane Training and Consulting, LLC. He is also a course author for Pluralsight, team member at Linchpin People, and co-author of 4 books.
Deployment Options Hi. My name is Robert Cain. Welcome to the second module in the Visual Studio Database Project series. This module will cover the deployment of a Visual Studio database project to a database server. In the previous module, we began with a brief overview of database projects, explaining what they were, and the history behind them. We then created a database project by reverse engineering the AdventureWorks 2008 R2 database. Next, we saw how to add new objects to the database. Finally, we learned how to refactor an existing database in order to minimize errors and side effects. Once you have your database completed, you will want to deploy it to your database server. There are many options that you can select to configure your database both during and after it is deployed. In this module we'll cover the important ones, discussing their pros and cons, as well as where they're located in the database project workspace. Finally, we'll see two examples of deployment, including debugging, a common issue for database developers. Be aware that the values you select for many of the options are largely dependent upon the stage of development you are at. Early in the process developers will typically deploy to their own work station. As work progresses, the code will then need to be deployed to a database server shared by the entire dev team. Finally, you will need to deploy to the testing and production servers. Note, I grouped these two together since I firmly believe that deployment to a testing environment should mimic as closely as possible the deployment to the production environment. We'll start our demo by learning all of the important deployment options and where they can be found in the database project. Next, we'll deploy a simple database based on the AdventureWorksLite database. Finally, we'll go through the steps to deploy a more complex database, in this example the full AdventureWorks database.
Unit Testing Hi. My name is Robert Cain. In this module of Visual Studio Database Projects series, we'll see how Unit Testing can add to the success of your database project. Let's start with a brief review. Module 1 began with an overview of database projects, after which we reverse engineered a database. We continued by adding new database objects to the project. Finally, we learned how to correctly refactor an existing database. In Module 2, we reviewed the many options available for configuring the deployment of your database project. For Module 3, we saw how the data and schema comparisons can be used to keep our project in sync with the target environment, as well as looked at pre and post deployment scripts. Finally, in the previous module, we learned how to generate realistic test data. If you have done unit tests against your. NET code in the past, you realize how important they are to the success of a project. Unit tests ensure your code does what it needs to, and that changes have not broken that need. Like. NET projects, it's also possible to use unit testing with database projects to test your various database objects. If you're coming from a SQL background, don't worry. While Visual Studio will generate the test framework in either VB. NET or C#, you don't have to understand any. NET to use them. All database project unit tests are written in T-SQL. It's time to actually create some unit tests. First, we'll let Visual Studio generate a unit test for us. Next, we'll create our own unit test from scratch. We'll also see how to use a data generation plan during the test process. Finally, we'll execute the tests and see how to debug errors raised during the process.