DataLibraryInheritance
----------------------
Shows how to inherit a data library from another data library.

Sample application WindowsApplication1 uses DataLibrary2 that is inherited from DataLibrary1.

Since a data library must have exactly one schema (C1SchemaDef component),
only DataLibrary1 has schema (in component schemaDef) and corresponding data objects assembly
(DataLibrary1.DataObjects.dll). DataLibrary2 uses the schema. It modifies some business logic
defined in DataLibrary1 (see virtual method c1TableLogic1BeforeFieldChange) and adds some additional
business logic that was not defined in DataLibrary1. To define business logic in the derived
DataLibrary2, add a C1SchemaRef component to DataLibrary2 and use it for the SchemaComponent
property of C1TableLogic and C1DataSetLogic components in the derived data library.
Note the line

schemaDef.Add(c1SchemaRef1);

in DataClass2 constructor. his line is necessary to connect c1SchemaRef1 to schemaDef.

This sample projects was created using the following steps:

(1) Create two data library projects using C1Data Project Wizard (select File|New|Project
in Visual Studio menu and select ComponentOne Data Library in the New Project dialog).
Create a schema in schemaDef in DataLibrary1 using the SchemaDesigner.

(2) Change DataLibrary2 class definition to inherit from DataLibrary1.DataClass1
instead System.ComponentModel.Component.

(3) Delete the schemaDef component from DataLibrary2.DataClass2.

(4) Delete the following line from DataClass2.cs:

using DataLibrary1.DataObjects;

It is not needed (and would cause compilation errors), since DataLibrary2 does not have its own
data objects assembly (DataLibrary2.DataObjects.dll), it uses DataLibrary1.DataObjects.dll.

(5) Add a C1SchemaRef component to DataClass2. Set its SchemaDef property to schemaDef.
Add the following line to DataClass2 constructor:

schemaDef.Add(c1SchemaRef1);

(6) Add necessary business logic components to DataClass2, connecting their
SchemaComponent property to the C1SchemaRef component. 

You can override business logic by delegating business logic events to virtual methods
of DataLibrary1 (see DataClass1.c1TableLogic1_BeforeFieldChange, it delegates to
virtual c1TableLogic1BeforeFieldChange) and overriding those virtual methods
in DataLibrary2.

You can also add new C1TableLogic and C1DataSetLogic components to DataLibrary2
to specify some new business logic for tables and data sets that do not have
C1TableLogic and C1DataSetLogic connected to them in DataLibrary1
(see DataClass2.c1TableLogic1 connected to Order Details table, there
is no C1TableLogic component connected to Order Details in DataLibrary1).

However, you are not allowed to connect a C1TableLogic (C1DataSetLogic)
component to a table (data set) in DataLibrary2, if this table (data set)
already has a C1TableLogic (C1DataSetLogic) component connected to it in DataLibrary1.
For example, if you add a C1TableLogic component to DataLibrary2 and connect it
to the Customers table, you will get a run time exception saying
"There already exists a C1TableLogic component for the table Customers".
If you need to override business logic for a table or data set that already have
some business logic defined in DataLibrary1, use the delegation technique
with virtual methods described above.



