Extending NDO

NDO has an open architecture. There are several interfaces at hand which can be used to intervene in the storage processing:

  • Callback-Interfaces
    If your persistent classes implement the interfaces IPersistenceNotifiable,  they are called back before objects are saved and after they are loaded. If they implement IDeleteNotifiable,  they are called back before an object is deleted.
  • Events and Callbacks
    The events CollisionEvent, IDGenerationEvent and OnSavingEvent  give a notification if certain processes in the system take place. RegisterConnectionListener allows you to create connection strings as soon as a connection is opened.
  • NDO Provider
    NDO cooperates with all well written ADO.NET providers. The NDO provider is a small layer between NDO and the ADO.NET provider. It levels differences between SQL dialects of different database products like the quoting of column and table names and the naming of parameters. You can write an own NDO provider by implementing the IProvider  interface or just derive a class from NDOAbstractProvider. A SQL script generator can easily be realized by deriving a class from ISqlGenerator. You just copy a new provider into the Provider subdirectory of your NDO installation. At the customers site you may use the UserSetup.msi to create a Provider directory. The UserSetup.msi can be found in the UserSetup directory of the NDO installation.
  • NDO Persistence-Handler
    NDO accesses data sources with the help of ADO.NET. This can be changed with your own implementation of the interfaces IPersistenceHandler and IMappingTableHandler. You can instruct a PersistenceManager to use a handler of a certain implementation of these interfaces using the PersistenceHandlerType property. Alternatively you can use the static function NDOSetPersistenceHandler that is added by the Enhancer to every persistent class. In that case the handler is only used for that single class. Note that you have to assign the new handler (or the handler type) before the first database access of the PersistenceManager for the corresponding persistent class. This is because the PersistenceHandlers are cached.
  • The NDO Mapping API
    This API allows reading and manipulating mapping files with the help of an object tree. More information can be found in the reference of the NDO Mapping API.
  • DataSet Schema Files
    NDO creates schema files that allow you to create or manipulate data directly with ADO.NET and without using NDO. To do that you use the function ReadXMLSchema of the dataset class. The schema files have the ending .ndo.xml and are located in the exe directory of a project, which is typically bin\debug or bin\release.
  • SQL Pass Through
    You can transmit SQL queries to NDO and get objects as result. That works if the Result sets have the same columns as they are defined in the mapping file of the respective type. The combination of mapping-API and SQL Pass Through also allows you to create your own query language for NDO if you need it.