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.
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.
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:
||A 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.|
||A 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.|
||A list of database connections. Most schemas have only one connection.|
||A list of physical database tables for the active connection.|
||A list of one or more named datasets that define a set of table views.|
||A graphical representation of database tables, field names, and inter-table relationships.|
||A .NET-style property grid that can be used to examine and customize the attributes of tables, fields, relationships, and other schema objects.|
||A results window for schema verification and error reporting.|
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.
C1DataSet properties are used to associate the component with a data schema:
||The name of a |
C1SchemaDef component on the form.
||The name of a dataset defined in the Schema Designer.|
The following properties are used to associate a bound control with a
||The name of a |
C1DataSet component on the form.
||The 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.
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 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.
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.
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.