Adding Database Objects to Visual SourceSafe in Visual Studio .NET


To demonstrate the implementation of source code control in a database project, you add code from your sample Asset5 database in Visual Studio .NET:

  1. Create the Asset5 database project in Visual Studio .NET.

  2. Open Solution Explorer.

  3. Make sure that the Asset5 database is one of the Database References. If the reference does not already exist, right-click Database References and select New Database Reference to create one that points to the Asset5 database.

  4. In Server Explorer, expand the Data Connections node.

  5. Expand the Assets node and keep expanding until you get to the list of stored procedures.

  6. Open a context-sensitive menu of one stored procedure and choose Generate Create Script to Project. The program will add its script to the Create Scripts folder of the project.

  7. Now, navigate Server Explorer until you find a list of tables and then open a context-sensitive menu of a table and choose Generate Create Script to Project. The program will add its script to the project as well.

    Note 

    Depending on the version and edition of Visual Studio that you have, the Generate Create Script command may or may not he available in the context-sensitive menu of a data connection node of Server Explorer. If it is available, you may use it to generate Create scripts of all database objects. If it is missing, you have two options—to use the TbDbScript tool described in the "Adding Database Objects to Visual SourceSafe: Traditional Approach" section, or to generate scripts using the Script Wizard of Management Studio (also described later in the chapter).

  8. Now we will add this project and all its files to Visual SourceSafe.

  9. Select File | Source Control | Add Project to Source Control. Visual Studio .NET will prompt you to log in to a Visual SourceSafe database:

    image from book

  10. Now Visual SourceSafe prompts you to add a project to the Visual SourceSafe database. Name the project (you can also type a comment to describe the project).

Visual SourceSafe creates a project and locks all Create scripts (scripts that can be used to drop and create objects from scratch). You can see a small lock icon beside each Create script in Solution Explorer:

image from book

Note 

From this moment, you must "check out" a Create script before you can change it.




Microsoft SQL Server 2005 Stored Procedure Programming in T-SQL &  .NET
Microsoft SQL Server 2005 Stored Procedure Programming in T-SQL & .NET
ISBN: 0072262281
EAN: 2147483647
Year: 2006
Pages: 165

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net