Developer .NET UPDATE—brought to you by the Windows & .NET Magazine Network
This Issue Sponsored By
DevConnections--Fall 2003 Dates Announced
DevConnections Tour--The Conference Comes to You
June 24, 2003--In this issue:
1. Developer .NET Perspectives
- Understanding Relationships in a Database Diagram
- New Active Directory Web Seminar!
- Attention Visitors to http://www.sqlmag.com
- Featured Thread: Upgrading to Windows .NET Framework 1.1
- Storage Road Show Event Archived!
5. New and Improved
- Develop Secure Web Applications
6. Contact Us
- See this section for a list of ways to contact us.
Sponsor: DevConnections--Fall 2003 Dates Announced
DevConnections = Microsoft ASP.NET Connections + Visual Studio Connections + SQL Server Magazine Connections + Microsoft Office System Conference. Four conferences for the price of one. Over 170 sessions to choose from.
Jump-start your fall 2003 training plans and secure your seat for DevConnections Fall, held Oct 13 - 15 in Palm Springs, CA. Don't miss this chance to get the latest roadmap from Microsoft, learn practical tips and insights that you'll use on the job immediately, and network with the top gurus in the industry.
Register now to receive the lowest possible registration fee plus access to all four conferences for one low price. Call 800-438-6720 or 203-268-3204 for more information.
1. Developer .NET Perspectives
Two weeks ago, I began an in-depth look at the ASP.NET Community Starter Kit. In that column, I showed you how to use Visual Studio .NET Enterprise Architect (VSEA) to reverse engineer the database that ships with the Community Starter Kit. VSEA is an excellent tool for both engineering and reverse engineering data structures. With VSEA, you can visually examine the relationships between key data structures as well as change the data structures and their relationships. Let's look at how to read the diagram that VSEA's reverse engineering process produced so that you can understand the existing database.
If you look at the database diagram for the Community Starter Kit, you'll notice a group of tables with names such as Community_Communities, Community_Sections, and Community_ContentPages. The diagram shows that these tables have "foreign key" relationships with other tables in the database. But before I discuss these tables and their foreign key relationships, you need to know about primary and foreign keys.
A foreign key relationship is a way to set up unique relationships in Microsoft SQL Server databases. The idea is that, in most cases, you need to uniquely identify the different rows of a table. To start the process of creating a foreign key, you create a primary key. A primary key is a column in a table. The primary key lets you assign either a piece of unique data or a unique ID to each row of data in that table. The unique value then becomes a way to identify that specific row of data. SQL Server also lets you use multiple columns to create a primary key, but for most application data, developers use only one column.
Foreign keys permit one table to reference items in another table. To reference items in a consistent repeatable manner, you use the primary key of the first table as the data element in the new table. For example, suppose you have two tables: a source table (i.e., the table that contains the items you want to reference) called SourceA and a target table (i.e., the table that's referencing entries in the source table) called TargetA. The primary key for SourceA is called PK_SourceA. (The primary key can have any name, although it's common to use the table name along with either the prefix of PK_ or the suffix _ID.) If you want an entry in the TargetA table to reference the SourceA table, you create a column of the same name--in this case PK_Source--in the TargetA table, then create a relationship to the original column in SourceA. Although you can't save the same values in PK_Source twice in the source table (a table can have only one primary key, and its entries must be unique), you can have different rows in the TargetA table reference PK_Source because PK_Source is a foreign key in the Target table. In other words, a target table can reference the same entry in the source table more than once.
Using SQL Server Enterprise Manager, you can easily create primary and foreign keys. For information about how to do so, see "Working with Keys" on the Microsoft Developer Network (MSDN) Web site (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vdtsql/dvtskworkingwithkeys.asp). In the Community Starter Kit, I already created the primary and foreign keys for the majority of tables. If you're using Microsoft SQL Server Desktop Engine (MSDE) instead of SQL Server 2000, you probably know that MSDE doesn't include SQL Server Enterprise Manager. However, you can use VSEA or T-SQL scripts to define primary and foreign keys.
Back to the Community Starter Kit Database Diagram
If you examine the Community_Communities table in VSEA, you'll see that several arrows point to this table. Each arrow represents a separate foreign key relationship. The arrow points from the source table's primary key to the target table. Below the diagram, VSEA provides additional information about the selected foreign key relationship. The information includes which columns in each table are involved with the selected relationship. This information lets you easily manage the relationships between different tables.
The database diagram for the Community Starter Kit includes another group of tables. These tables don't show relationships to other tables. Examples of these types of tables include Community_SampleSections and Community_SampleContentPages. If you were to open these tables in the database, you'd see that they have much the same data that's in the Community_Sections and Community_ContentPages tables. In addition to not having the same relationships defined, these sample-site tables have slightly different columns, but the core data is identical.
The reason for the second copy of the same data is that the starter kit lets you create multiple communities within your site database. In the process of creating multiple communities, the Community Starter Kit automatically creates each site with the sample data from those sample-site tables. Each time the Community Starter Kit creates a new community, the ISPAdmin pages reference these tables and copy these standard settings into your tables. Because the settings include the default user accounts that have been defined for the sample, you shouldn't publish these tables in your production Web environment unless you need to support the ability to create new communities on the fly. You can remove the sample-site tables from the database if necessary.
In addition to using VSEA to understand databases, you can use VSEA to update the table structures, add primary and foreign keys, and transfer the changes back into the actual database. I'll discuss how to perform these updates after I show you the next step, which is to get a better understanding of the code that makes up the Community Starter Kit.
Sponsor: DevConnections Tour--The Conference Comes to You
Can't make it to one of our major conferences? We will bring the conference to you. Join Paul Litwin and Carl Franklin for 2 days of solid, in-depth training in ASP.NET and VB .NET. Special keynote by Microsoft's Rob Howard.
Attend either the ASP or VB track for the entire two days or move from one track to the other as you desire. Don't miss this chance to get in-depth training from the experts in a highly interactive environment. Bring your questions and get the answers you need. You'll discover new tips and shortcuts to help you build better and more secure applications and web services faster.
Coming to a city near you. Get ready for the transition in development by learning from the best and keep your competitive edge.
Register today before these events sell out:
(brought to you by Windows & .NET Magazine and its partners)
Discover how to securely managing Active Directory in a multiforest environment, establish attribute-level auditing without affecting AD performance, enhance secure permission management with "Roles," and more! There's no charge for this event but space is limited--register today!
If you've been putting off subscribing to SQL Server Magazine, now's the time to act. Starting July 1, the last 24 issues of SQL Server Magazine online will be locked down and available only to subscribers. For a limited time, subscribe at the best rates ever offered online!
Forum senior member Patrick wants to know whether he needs to uninstall the original version of the Windows .NET Framework before installing version 1.1. He also wants to know whether he can use a script to automated the upgrade. To join the discussion, go to the following URL:
(brought to you by Windows & .NET Magazine)
Couldn't make the HP & Microsoft Network Storage Solutions Road Show? View the taped event archives from your Web browser!
5. New and Improved
by Sue Cooper, [email protected]
Sanctum released AppScan Developer (DE) 1.7, an automated testing tool for secure application development in major IDEs, including Visual Studio .NET 6.0, Borland Software's JBuilder, IBM WebSphere Studio Application Developer, and Eclipse. Integrated into Visual Studio .NET, the software provides automated precision script creation; security unit testing; comprehensive defect analysis; and real-time, inline fix recommendations. Developers involved in security testing and secure coding can also use AppScan DE as a real-time training tool. Pricing is $1495, with a promotional price of $995 through August 1, 2003. Contact Sanctum at 408-352-2000, 877-888-3970, or [email protected]
Integrate FAX into Exchange/Outlook (Whitepaper, ROI, Trial)
Jerry Honeycutt Desktop Deployment Whitepaper
6. Contact Us
This email newsletter is brought to you by Windows & .NET Magazine, the leading publication for IT professionals deploying Windows and related technologies. Subscribe today.
Copyright 2003, Penton Media, Inc.