Click here to Skip to main content
15,879,326 members
Articles / Product Showcase
Article

ComponentOne DataObjects for .NET

2 Nov 20036 min read 60.2K   12   2
ComponentOne DataObjects for .NET (C1DataObjects) is based on Microsoft ADO.NET technology and enhances it in many significant ways to streamline database application development.

This article is in the Product Showcase section for our sponsors at CodeProject. These articles are intended to provide you with information on products and services that we consider useful and of value to developers.

This is a showcase review for our sponsors at CodeProject. These reviews are intended to provide you with information on products and services that we consider useful and of value to developers.

Introduction

ComponentOne DataObjects for .NET (C1DataObjects) is based on Microsoft ADO.NET technology and enhances it in many significant ways to streamline database application development. C1DataObjects follows the standard business object paradigm, enabling developers to write business logic components called data libraries, which can be reused in multiple projects. This provides a clear separation of the business logic from the presentation layer, or GUI. Another advantage of this architecture is that data libraries can be used in both WinForms and WebForms applications.

C1DataObjects also provides an innovative virtual mode technology that makes it ideal for working with large datasets in WinForms applications. In fact, since ADO.NET cannot handle large datasets, using C1DataObjects is the only way to overcome this limitation.

C1DataObjects completely automates the development of distributed 3-tier web-based applications, freeing developers from the task of writing special server-based code. For even greater control over application performance, ComponentOne WebDataObjects for ASP.NET encapsulates the functionality of C1DataObjects and provides optimizations for server-side caching and object pooling.

Defining a Data Schema

The easiest way to get started with C1DataObjects is to connect to an OLE DB data source and import its structure into a data schema, which is represented by a C1SchemaDef component on the form. This component provides access to the Schema Designer, which is used to specify the tables and fields that are exposed to bound controls and other data consumers. The Schema Designer's Import Wizard prompts for a connection string and login credentials, then displays the tables, views, and aliases available for import.

Import Wizard
The Import Wizard can connect to any OLE DB data source.

The Schema Designer displays a graphical view of the underlying database structure and the datasets that are exposed to consumers. It contains the following windows:

TablesA list of available database tables, both simple and composite. A simple table is a physical database table. A composite table represents two or more related tables, which can be any combination of simple and composite. From the perspective of the data consumer, there is no difference between simple and composite tables.
RelationsA list of relations between pairs of tables based on foreign key constraints stored in the database. Relations can also be defined manually in the Schema Designer.
ConnectionsA list of database connections. Most schemas have only one connection.
DB TablesA list of physical database tables for the active connection.
DataSetsA list of one or more named datasets that define a set of table views.
Schema GraphA graphical representation of database tables, field names, and inter-table relationships.
Property BrowserA .NET-style property grid that can be used to examine and customize the attributes of tables, fields, relationships, and other schema objects.
OutputA results window for schema verification and error reporting.

Schema Designer
The Schema Designer provides a graphical interface for defining the database structure.

Binding to a Schema Dataset

Each data schema must contain at least one dataset, which is a collection of tables and relationships as they are exposed to data consumers. Typically, a dataset exposes a subset of the available tables in the underlying data source. The C1DataSet component represents a dataset and serves as a data source for bound controls.

The following C1DataSet properties are used to associate the component with a data schema:

SchemaDefThe name of a C1SchemaDef component on the form.
DataSetDefThe name of a dataset defined in the Schema Designer.

The following properties are used to associate a bound control with a C1DataSet component:

DataSourceThe name of a C1DataSet component on the form.
DataMemberThe name of a table view defined in the Schema Designer.

Creating Composite Tables

One of the key features of C1DataObjects is the ability to combine multiple tables in a single aggregate that is exposed to data consumers as a simple table. Composite tables are similar to database views formed by an SQL statement with joins. However, with C1DataObjects, developers can specify tables and relationships using database diagrams in the Schema Designer without writing SQL.

Composite Table
A composite table created from three simple tables.

Within the Schema Graph window, each simple table is represented by a child window containing a list of field names with check boxes. Only the checked fields will be exposed to data consumers. Developers also have control over the default field name order in the composite table, and can designate individual fields as read-only.

When an application attempts to modify a row in a composite table, C1DataObjects automatically collects all modified simple table rows and sends them to the server for updating.

Defining Master-Detail Relationships

By defining view relations between tables in the Schema Editor, developers can implement master-detail relationships between bound controls without coding. If view relations are defined, the DataMember property of bound controls will display additional nodes representing the parent/child portions of the relation. At run time, the detail control automatically responds to row currency changes in the master control.

Master-Detail Grids
Master-detail grids implemented without coding.

Creating Calculated Fields

C1DataObjects supports the creation of calculated fields based on expressions that involve other database fields. To the data consumer, calculated fields are indistinguishable from native database fields.

Calculation Expression
A calculated field expression specified in the Schema Designer.

Specifying Constraint Expressions

A constraint expression can be used to specify the range of legal values when a database field is being updated. By placing such constraints within the data schema, business logic can be centralized and maintained in a single location.

Constraint Expression
A constraint expression specified in the Schema Designer.

At run time, invalid data entry results in the display of the specified error message.

Using Data Libraries

The recommended way to use C1DataObjects is to create a data library project that defines a single schema, then reuse the data library in multiple projects. Note that both WinForms and WebForms projects can share the same data library.

To consume a data library in another project, the developer adds a reference to the data library assembly, then sets the DataLibrary property of the C1DataSet component(s) to the filename of the assembly, excluding the .DLL extension. In this scenario, the SchemaDef property is not used since the C1SchemaDef component resides in the data library itself.

Downloading an Evaluation Version

C1DataObjects offers many other features not described in this article, including:

  • Virtual mode technology for binding to large datasets in WinForms applications.
  • Programmable business logic components for customizing the behavior of datasets and table views.
  • SQL-based tables for supporting nonstandard SQL and stored procedures.
  • Unbound tables for non-SQL data sources populated in event handlers.

C1DataObjects is part of ComponentOne Studio for .NET. To download an evaluation version, please visit www.componentone.com.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
United States United States
When it comes to software components, John Juback is one of the pioneers, with over 25 years of experience developing controls for desktop, web, and mobile platforms. A Carnegie Mellon alumnus, John specializes in integrating GrapeCity’s core products with emerging technologies to create off-the-shelf solutions that appeal to end-users and developers alike.

Comments and Discussions

 
GeneralIt is just a bug-rich component!! Pin
b_khoshbin1-Mar-04 7:14
b_khoshbin1-Mar-04 7:14 
GeneralRe: It is just a bug-rich component!! Pin
Glenn Dawson9-Mar-04 14:36
Glenn Dawson9-Mar-04 14:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.