.NET
  Home arrow .NET arrow Page 8 - The Basics
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Mobile Linux 
App Generation ROI 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
.NET

The Basics
By: Apress Publishing
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 19
    2005-04-06

    Table of Contents:
  • The Basics
  • Modeling a Logon Process
  • Coding Conventions
  • Generating the VB .NET Code for the Logon Class
  • Generating the C# Code for the Logon Class
  • ER and ORM Diagrams
  • Generating the Database
  • Reverse Engineering a Database

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    The Basics - Reverse Engineering a Database


    (Page 8 of 8 )

    Reverse engineering is, as the name suggests, the reverse of forward engineering or code generation from a UML model. So, reverse engineering is when you create a UML model from an existing VS .NET project or even from an existing database. With VSEA, you do any reverse engineering from within the VS .NET IDE. With stand-alone Visio 2000 Professional and Enterprise Editions, Visio 2002 Professional Edition, and the Visio 2003 Professional Edition, you can do it from within Visio.

    As an example, let’s try reverse engineering a database table. We’ll reverse engineer the Customers table from the Microsoft Access Northwind example database,7 but you can just as easily choose to reverse engineer a copy of the Customers table from your own organization. In Exercise 1-16, make sure you replace the Microsoft Access Northwind bits with the setup for your desired data source.

    EXERCISE 1-16

    1. Open VEA (if it isn’t already open).

    2. To create a new database model, select File -> New -> Database -> Database Model Diagram.

    3. Start the reverse engineering by selecting Database -> Reverse Engineer. This brings up the Reverse Engineer Wizard, as shown in Figure 1-22.


    Figure 1-22.  The Reverse Engineer Wizard

       4.  If you already have an ODBC DSN for the data source you want
            to reverse engineer a table from, select it from the Data 
            Sources list and skip to step 13. If not, click the New button to 
            create one. The Create New Data Source dialog box is now
            shown.

       5.  Select the System Data Source option and click Next.8

       6.  Select Microsoft Access Driver from the list and click Next.

       7.  Click Finish. The ODBC Microsoft Access Setup dialog box is now
            shown.

       8.  Type Northwind in the Data Source Name text box.

       9.  Click the Select button. This brings up the Select Database
            dialog box, which is really nothing more than the well-known
            Open File dialog box.

      10.  Browse to the Northwind.mdb database file on your system, or
            type in the name and path in the Database Name text box. It’s
            usually located in the Program Files\Microsoft Office\Office11
            \Samples folder (if you have Microsoft Office 2000 or Microsoft
            Office XP installed).

      11.  Click OK.

      12.  Click OK in the ODBC Microsoft Access Setup dialog box.

      13.  Click Next.

      14.  Click OK in the Connect Data Source dialog box, unless you   
            have specified a user name or a password for the database.

      15.  Remove the selection from the Views option on the database
            objects review page of the Reverse Engineer dialog box and click
            Next.

      16.  Select the Customers table on the database tables review page,
            as shown in Figure 1-23.


    Figure 1-23.  The database tables review page of the Reverse Engineer Wizard

      17. Click Finish. Your database model diagram is now updated with
           the reverse-engineered Customers table, as shown in Figure 1-24.


    Figure 1-24.  The reverse-engineered Customers table on a class diagram


    Summary

    This chapter introduced you to enterprise modeling by means of one UML model that was used for generating a class (Logon) in VB .NET and C#, as well as a database model that was used for generating a small database with just one table (User) in Microsoft Access.

    These two simple models were described in detail, and you saw how the two models were created and how the actual code and database were generated from within VEA. You also saw how you can reverse engineer an existing database into a database model diagram.

    So why would you really want to use modeling for your enterprise solutions? Well, modeling is quick, and it saves a lot of the drudgery of repeated typing because of DDL scripts and the code skeleton generation. Modeling also serves as part of the solution documentation. Another important reason is that you reduce the risk of errors when data names and data types are transcribed between designs, databases, and application code.

    The next chapter presents some guidelines for how to design and plan your projects and solutions.


    1. A UML model is never really complete, meaning you can always find
        things that can be
    expressed in a more detailed way. Our intention
        in stating that a model can be complete or
    incomplete is that you
        can say it’s complete when all parties involved are satisfied that 
        the
     information they want is contained in the model in the desired
        details. In other words, when
    it’s good enough to proceed to the
        next stage.

    2. Rational Software was acquired by IBM, and the company is now
        called IBM

    3. If you have specified that VS .NET should open the last loaded
        solution when opening, you can change that from the Options
        dialog box, or you can manually open the generated code file.

    4. The next version of VS .NET, code-named Whidbey, should be able
        to handle unsigned data types. It is scheduled to be released
        sometime in 2004.

    5. Table is a physical database term, and entity is a conceptual
        database term. You should keep this in mind, because Visio
        sometimes seems to mix the two.

    6. You can just as easily choose one of the other options, but for the
        sake of this example, please follow the exercise.

    7. The Northwind sample database comes with most versions of
        Microsoft Access, but it’s also an optional setup part of Microsoft
        SQL Server 2000.

    8. You can just as easily choose one of the other options, but for the
        sake of this example, please follow the exercise.

    This article is excerpted from Enterprise Development with Visual Studio .NET, UML, and MSF by John Erik Hansen and Carsten Thomsen (Apress, 2004; ISBN 1590590422). Check it out at your favorite bookstore today. Buy this book now.


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

     

    .NET ARTICLES

    - Using CrystalReportViewer to Display Crystal...
    - Creating Summary .Net Crystal Reports
    - More on Commands, Input and the WPF
    - Grouping and Aggregating When Querying LINQ ...
    - Commands, Input and the WPF
    - Keyboard and Ink Input with WPF
    - Mouse Input and the WPF
    - Input with Windows Presentation Foundation
    - Introducing LINQ with XML and Databases
    - An Introduction to LINQ
    - Querying LINQ to SQL: Basics
    - Completing a Simple Storefront with LINQ
    - Knowing Your Environment: the System.Environ...
    - Creating the Home Page for a Simple Storefro...
    - LINQ Quickly with Language Integrated Queries

     
    Best Practices for Windows Vista Migration Presentation
    Dell and Microsoft recently held a series of face-to-face seminars entitled, &qu....

     
    Creating a Culture for Code Reuse
    If you oversee development teams you know that like it or not proprietary and ex....

     
    Keys to Web Application Acceleration: Advances in Delivery Systems
    Accelerate Web apps by up to 5x. Ensure significantly faster access to the Web a....

     
    Optimizing Application Monitoring
    Tired of finding out from your customers that you're offline? This white paper e....

     
    Solaris to Solaris Migration -- Migrating applications from Sun SPARC to Dell PowerEdge R900
    This comprehensive Migration Guide reviews the approach that Principled Technolo....

     




    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
    Stay green...Green IT