Adapter

This section describes various aspects of the generated code specific to the Adapter template group. You can generate code using Adapter templates by choosing the template group 'Adapter' in the generator configuration dialog in the designer when generating code.

Adapter generates two Visual Studio projects into two specific directories: a database generic project and a database specific project, suffixed by default by DbSpecific. If you want to work with data in the database (read/write data) you need a reference to a database specific project which is generated from the same set of Entities, this means: any database generic project can be used with any database specific project as long as the database specific project is generated from entities/typed views/typed lists which have the same names for entities/typed lists/typed views/ and fields. This way you can create software which targets a single database generic project and two or more database specific projects, one for each database type (e.g. Oracle or SQL Server).

The LLBLGen Pro designer generates for a project with relational model data from one database type a database generic Visual Studio project and a database specific Visual Studio project. For a project with relational model data from two or more database types, it will generate one database generic Visual Studio project and for each database type a database specific Visual Studio project.

You can use the classes in the database generic Visual Studio project with any of the generated database specific Visual Studio project. This way you can for example fetch an entity from SQL Server and save it in Oracle, by using the DataAccessAdapter class of the SQL Server specific database specific Visual Studio project to fetch the data and the DataAccessAdapter class of the Oracle specific database specific Visual Studio project to save the data.

The DataAccessAdapter class is located, together with the stored procedure call classes, in the database specific project, all other code is located in the database generic project. This means that when you only want to use an entity class, you can just reference the database generic project and use the entity object. If you need to interact with the persistent storage, you need a reference to a database specific project which knows the configuration of the entity classes in your database generic project.

Adapter code is not compatible with SelfServicing code. You can however use both in the same application (although not recommended as it might be confusing) and you can share validation classes.

Compilation of the generated Visual Studio projects

To compile the two Visual Studio projects, do as you normally would, load the project into Visual Studio and compile it (build it). The output folders for the projects are located in the specific folders per project (DatabaseGeneric\bin... and DatabaseSpecific\bin...).