Welcome Guest!
Create Account | Login
Locator+ Code:

Search:
FTPOnline Channels Conferences Resources Hot Topics Partner Sites Magazines About FTP RSS 2.0 Feed



email article
printer friendly
get the code
more resources

Generate Data-Based Web Sites With Blinq
Blinq 1.0 is Microsoft's prototype of an extension to LINQ to SQL (formerly DLinq) that auto-generates a complete data-entry and editing ASP.NET 2.0 Web site by executing a simple command-line statement.
by Roger Jennings

June 26, 2006

Visual Studio's propensity to auto-generate Visual Basic or C# code is a controversial topic. You might—like Charles Petzold—consider .NET code generation by VS to be a pernicious compulsion/obsession (see Resources). Many developers believe it's a beneficial or even indispensable VS feature. Regardless of your position on the desirability or quality of VS's auto-generated code, it's a reasonably sure bet that Orcas—the code name for VS v.Next—will generate much more code for (or against) you than VS 2005.

ADVERTISEMENT

For example, running the SqlMetal.exe utility under Orcas to generate LINQ to SQL (formerly DLinq) object-relational mapping (ORM) code for a simple, eight-table Northwind database adds 2,089 lines (including empty lines) to the Northwind partial class and expands Northwind.vb to 61K (see Resources). Of course, LINQ to SQL ORM code pales in comparison to that for a typed Northwind DataSet, which weighs in at 9,204 VB 2005 lines (551K), and might become even larger in Orcas.

The ASP.NET v.Next team's first entry in the "Orcas Code Generator Sweepstakes" is the new Blinq 1.0 prototype that went public on June 13, 2006 (see Resources). Scott Guthrie gave the first Blinq demonstration to developers in his June 15 "ASP.NET: End-to-End—Building a Complete Web Application Using ASP.NET 2.0, Visual Studio 2005, and IIS 7" Tech•Ed 2006 presentation. According to Blinq's developer, Polita Paulus, "Blinq prototypes functionality we are building into our next version of ASP.NET." Paulus, by the way, wrote the ASP.NET 2.0 GridView, DetailsView, and FormView controls.

Blinq.exe is a deceptively simple command-line tool—similar to SqlMetal.exe for LINQ to SQL—that auto-generates a complete, fully navigable Web site for viewing, editing, adding, or deleting data in a SQL Server database. First, I'll describe how to use the Blinq 1.0 prototype bits to create a 25-page ASP.NET 2.0 Web site from the Northwind sample database in less than a minute. The site's total size is slightly more than 1.0 MB, of which 115K is auto-generated; LINQ and Blinq assemblies copied to the …\bin folder contribute 889K. Next, I'll show you how to navigate the site and perform typical data-entry and editing operations in GridView and DetailsView controls. Finally, I'll briefly describe the basics of customizing master-page and homepage layout to make more efficient use of display real estate.

Blinq 1.0 requires VS 2005 Standard Edition or higher, or Visual Web Developer 2005 Express, and SQL Server 2000 SP4, 2005 SP1, or Express SP1. You must install the LINQ May 2006 Community Technical Preview before running the BlinqSetup.msi (see Resources). The installer creates a \Program Files\Microsoft ASP.NET\Blinq folder, which contains DLLs for the project's \bin folder, and adds BrowserFiles and ThemeFiles subfolders. IIS 5.0+ on the test machine is optional.

Before running this article's sample code, execute the InstNwnd.sql sample script to install the Northwind database in a SQL Server instance (see Resources). Prevent bloating the app with 12 pages that have minimal or no significance by deleting the CustomerCustomerDemo, CustomerDemographics, Employee Territories, Territories, and Region tables before running Blinq.exe.




Back to top













Java Pro | Visual Studio Magazine | Windows Server System Magazine
.NET Magazine | Enterprise Architect | XML & Web Services Magazine
| | Discussions | Newsletters | FTPOnline Home