Tier-1 Framework Projects:
If your application will use a relational database, then include the project called AbstractionLayer. If using any xml data sources, then also include the project called AbstractionLayerXml.

Tier-2 Schema Projects:
For each database schema you have (usually just one), you need to create a new class library which references AbstractionLayer. Use the class generator to connect to the database and generate classes for each table (see screenshots in appendix).

For xml data models, reference AbstractionLayerXml, and use the separate xml class generator to create classes from an XSD file, retaining the XSD in the project for reference.

Tier-3 Application Projects:
Any application that uses an xml or relational data source should reference the appropriate Tier 1 & 2 projects to manage and abstract the data into the .Net environment.

Configuration Settings
For storing database connection strings, the default option is a pair of configuration settings: “Driver” and “ConnectionString”, where driver can be “oledb”, “sqlserver”, “oracle”, etc (you can easily add more). This logic is implemented in the useful property called AbstractionLayer.CDataSrc.Default.

A second option is to provide a similar custom property in your Tier-2 schema project, which reads your own configuration settings and uses them to create a single, static CDataSrc instance (such as CMySql). This will be used automatically if you override a protected method in each of the table-mapping classes (that derive from CBase) called GetDefaultDataSource().

The third option is to implement this property at the application level, and pass it to the constructor of the business objects when they are instantiated. For example, the application may need to talk to several database instances with the same schema, and control this by supplying different data sources to the object constructors at different times. If this is used with caching, you need to implement the caching at the application layer.

Last edited Apr 14, 2008 at 11:39 AM by jeremyconnell, version 3

Comments

No comments yet.