First Looks

Use Managed Database Providers

DataDirect Connect for .NET 2.1 supplies dedicated providers for Oracle, SQL Server, DB2, and Sybase databases to give you high-performance data access that's easy to use (see Figure 1). The providers are similar to the OLE DB and SQL Server providers that come with VS.NET, but you'll gain several benefits by moving to DataDirect Connect's providers.

Extensions to the DataDirect providers support database-specific features. For example, the Oracle provider supports a variety of connection-string properties that give you additional control over the environment. The Oracle provider also allows you to use the ROWID pseudo column and to return a rowset from a stored procedure. All the providers support tracing functions you can control through either object references or environment variables. The tracing capability can be invaluable for support.

DataDirect stresses that its providers use 100-percent managed code—that is, no code outside of the .NET Framework. This provides additional security and reliability by reducing opportunities for hacking. The DataDirect providers all support connection failover: The connection object retries on failed connect attempts and can even work through a list of servers when attempting to connect. The connection failover capability works with client-side load balancing, which instructs a connection object to select a server randomly from a list of candidates in order to spread the database workload among multiple servers. These and other capabilities can increase your application's scalability greatly.

If you use the OLE DB or SQL Server providers already, moving to DataDirect Connect's providers is simply a matter of adding a reference to your project, adding a Use statement for the new provider's namespace, and replacing the names of your OLE DB classes with the new provider names. All the OLE DB training material translates easily to the DataDirect Connect providers, and DataDirect's thorough documentation is complete with C# and VB.NET samples for all databases. The documentation does a particularly good job of showing how to translate Oracle data types into .NET data types. DataDirect's customer support staff is knowledgeable and helpful.

The only drawback with DataDirect is that you must change all your data-access class names if you change database platforms. However, this is probably a minor consideration for most applications, particularly those using a tiered architecture. You should definitely consider DataDirect Connect for complex applications with scalability and security concerns. The developer time you can save through its strong support for native database functionality and tracing can translate into significant savings.

DataDirect Connect for .NET 2.1
DataDirect Technologies
Phone: 800-876-3101; 301-468-8501
Price: Contact vendor for pricing.
Quick Facts: Replaces OLE DB providers with highly scalable and secure native providers.
Pros: Good support and performance capabilities.
Cons: Changing database platforms requires code changes.

Enhance WinForms UIs
by David Mack

September 13, 2004

You want each UI you create to be as versatile and easy to use as possible. The current set of WinForms components that come with VS.NET are good, but they don't offer some of the more-advanced features users might want. Xceed SmartUI for .NET is a suite of components that let you enhance your UIs with ease (see Figure 1). They include components such as MenuBars, an Office task pane, an Explorer task pane, CheckedListBoxes, and OutlookBars. You can create UIs with a Windows XP, Office 2003, Office XP, or standard Windows style.

Installation of SmartUI for .NET is straightforward. The product requires that you enter the license key in your source code. (You'll get a license exception every time you run the application if you don't enter the key.) You can see the Xceed key in your assemblies, so I recommend using an obfuscation tool to protect the key. I also recommend putting the license key in your initialization routine so that your application calls it before any of the Xceed components.

The product includes helpful examples implemented in both VB.NET and C#. You can run them quickly, see how they work, and start using the controls. A nice feature of the suite is that you can see how your application will look without needing to compile it. This saves you from going back and forth to make little adjustments and verify the results.

The SmartTabStrip component is especially impressive. If you're familiar with Office XP, you know how tabstrips can complement a UI. You can use SmartTabStrip to create an application that lets users configure settings intuitively. They can see the values they're modifying, and you can enable fields based on values they place in the component. The SmartExplorerTaskPane is easy to use and enhances an interface nicely. The pane lets you give the user a context-sensitive list based on user inputs. The least impressive component is the SmartCheckedListBox, which differs from a standard WinForms listbox only by adding a checkbox.

I was able to create an Outlook-style application in no time. I noticed a bit of a performance lag when I built my next application, which used a SmartCheckedListBox that required a lot of control updates. I checked the Xceed Web site and found a way to suspend and resume the interface's "paint" functionality, which saves you the time you'd otherwise lose repainting the control after each update.

The Xceed Web site is well laid out and easy to navigate, and it includes online forums and a knowledge base. The company appears to take customer feedback into consideration when creating new features.

Xceed's SmartUI for .NET is a nice suite of components for enhancing any GUI. The flexibility it gives you for controlling UI styles is great. You can give your applications a professional look and feel with a small amount of coding.

SmartUI for .NET
Xceed Software
Phone: 800-865-2626; 450-442-2626
Pricing: Contact vendor for pricing.
Quick Facts: Components for building rich UIs.
Pros: Lets you enhance any WinForms application quickly; easy to design without compiling.
Cons: Some help links don't work; key is embedded in executable.

Generate Database-Driven Web Sites
by Ken Cox

Microsoft's ASP.NET team aims to reduce the amount of code Web developers need to write by 70 percent. Most database-driven sites employ common features, such as authentication, master/details pages, data-entry forms, and reports, making these good candidates for productivity tools. Iron Speed Designer 1.6 Enterprise Edition exceeds the code-reduction goal by generating almost all the code that an average data-oriented, three-tier Web application needs.

The software's strength is the way it bridges the reliability of a prepackaged application with your customizations. Application Builder's well-implemented interface guides you through your own data. If you need new data fields for the page, you simply fix the database schema and jump back to the database step to build in the changes. You can click on the Build and Run Application button at any time to see your progress in the browser.

Starting out, you set application details, such as the site's name and location, then pick a page style. The six page designs are adequate but not spectacular (see Figure 1). Next, you hook up to your database. (Designer 1.6 supports only SQL Server, which might be a showstopper for some.) Moving on, you select the tables, fields, views, and queries to use in the Web application. The choices and options are presented clearly and simply.

In the Pages step, Designer suggests the ASP.NET pages you should create based on the data structure and project settings, such as which tables need to be editable. This is also where you can customize the site without coding. For example, you can easily change the default multiline textboxes to a single-line style. You can click on the control to bring up a Properties page to change a wide range of properties, bindings, and SQL statements.

Designer lets you insert your own code into its "safe" classes without fear of overwriting it during the next regeneration. Likewise, you can integrate third-party controls, as long as you work within Iron Speed's framework. The tool generates a buildable VB.NET project complete with ASP.NET pages and code-behind source. Be aware that Iron Speed's designers aren't compatible with VS.NET's Web Forms designer. Stick to the intended environment for editing rather than trying to mix and match.

Although Designer makes difficult tasks easy, I lost time on minor issues, such as adding an unbound Web page and changing the default logo. The extensive online help is fine for understanding concepts, but it needs more task-based procedures with precise steps. Don't miss the excellent videos that demonstrate the software's features.

This product works as advertised. Hard-core .NET coders might find it confining, but Iron Speed Designer opens development of data-oriented ASP.NET sites to a broader and much less technical audience.

Iron Speed Designer 1.6 Enterprise Edition
Iron Speed
Phone: 650-215-2200
Price: $1,995
Quick Facts: Advanced code generator for database-driven Web applications.
Pros: Works well; preserves customizations; excellent video introductions.
Cons: Supports only SQL Server; needs task-oriented documentation.

Convert VB.NET Code to C#
by Don Kiely

Sometimes you have good reasons to use one .NET language over another. Much as you might love VB.NET, you must use C# occasionally (or vice versa). It would be nice to have an easy way to convert code from one language to the other.

Tangible Software Solutions' Instant C# 1.7 takes care of one direction of the conversion—from VB.NET to C# (see Figure 1). You can feed it either a complete VB.NET project or a snippet of code. The snippet feature is handy for comparing how the C# code would look for a particular task. Tangible claims that Instant C# converts 99 percent of all VB.NET code, the highest rate in the industry. It can't, and shouldn't, handle some constructs, such as antiquated OnError Resume statements, When statements in Catch blocks (because C# doesn't support them), and inline ASP.NET code.

I threw Instant C# to the wolves, feeding it the fairly large middle-tier VB.NET objects for my current project. When I started the conversion, Instant C# found that it needed help resolving some of the project's references by name to external assemblies. A dialog box made it easy to resolve these. Instant C# eliminates a reference from the list after you tell it where to find the appropriate DLL and it verifies that the file has the necessary namespace. Once that's done, it begins the conversion.

Conversions are normally a one-time job, so performance isn't as important as the quality of the output code. My conversion took an hour and 40 minutes for 110,114 lines of code, 648 code files, and the new csproj file. Instant C# made 2,208 notes where it made a change worth checking, such as initializing loop variables in the foreach statement rather than in a separate statement. I had 108 TODO conversion tasks that Instant C# didn't handle, most dealing with parameterized properties that C# doesn't support. The project won't compile until I deal with them.

Instant C#'s UI is functional but immature. For example, if an output directory for the C# project doesn't exist, Instant C# won't create one. It never repaints itself during the conversion process and offers no status information about its progress. The best I could do was check the Windows Task Manager periodically to make sure Instant C# was still running.

The product ships as a single executable file, living up to the promise of .NET xcopy deployment. Unfortunately, this also means that you get no documentation other than a basic FAQ on the company's Web site. You might not miss the documentation, though, because the product's function and operation are straightforward.

No conversion is ever fully automatic; you'll always need to check and tweak the output code. However, Instant C# does a fine job of converting VB.NET code to C#, doing the vast bulk of the work for you.

Instant C# 1.7
Tangible Software Solutions
Phone: 604-930-9949
Price: $159
Quick Facts: VB.NET-to-C# converter for short code snippets or full projects.
Pros: Produces generally good code; intelligent handling of incompatible syntax.
Cons: Immature UI; no status information for long operations.

comments powered by Disqus
Upcoming Events

.NET Insight

Sign up for our newsletter.

I agree to this site's Privacy Policy.