DomainObjects for .NET Features

Type-Safe SQL Statements

  • Type-safe, IntelliSensetm supported object queries
  • Queries are made against persistable objects rather than directly against the database tables. Results are returned as a strongly typed persistable object or list of persistable objects
  • DataSet or 'report' query support. An arbitrary set of columns can be retrieved from a persistable object and/or its related objects. Results are returned in a DataSet
  • Design-time declaration and runtime generation of left, right, full outer joins and cross joins
  • Support for type-safe SQL SELECT expressions: top, union, union all, group by, having, order by, column aliases, etc.
  • Support for type-safe SQL functions: AVG, CASE, COUNT, DATEDIFF, DATEPART, GETDATE, MAX, SUM, etc.
  • Support for 'polymorphic' queries: when a base-type is queried, sub-types are also queried and returned.
  • Support for type-safe batch update statements defined in terms of your object model. See the UpdateByCriteria class for an explanation and a code example.
  • Support for type-safe batch insert statements defined in terms of your object model. See the InsertByQuery class for an explanation and a code example.


  • Attribute-based transaction management. I.e., transaction boundaries (units-of-work) and their composition are defined by .NET custom attributes. DomainObjects automatically and transparently handles the database commit/abort. Utilizes semantics of COM+ enterprise services, but without the heavy COM+ infrastructure
  • Automatic insert, update, delete, retrieval of object graphs per repository collection/reference definitions
  • Optimistic concurrency support

Performance and Quality

  • A call-stack-level cache : when a persistable object is modified, any method executing in that call stack that reads the object will see the modified value(s)
  • Lazy loading of object references and collections
  • Connection pooling support
  • Use of DataReader for optimal performance rather than DataSet or DataTable
  • Use of SqlParameter cache
  • Prefetching of related objects in an object graph to prevent database roundtrips. See the Prefetch API for an explanation and code example.
  • Over 275 automated NUnit regression tests integrated with the DomainObjects build

Developer Productivity

  • A tool to automatically reverse-engineer your database schema into an object to relational mapping xml file used by DomainObjects (RepositoryGen.exe)
  • A persistable object code generator (DomainObjectGen.exe). The code generator creates partial classes from the object-relational mapping file. These partial classes contain the persistent fields along with property accessors and constructors.
  • Code generation of persistable object fields to be used when creating queries. Enables compile-time feedback and correction of queries as your database schema changes
  • A set of common persistable object base classes provide functionality needed in a typical persistable object layer:
    • Primary key definition and management
    • Equals and Hashcode overrides
    • Internal state management flags for greater performance and correctness: isEdited, isNew, needsDelete, etc.
    • Shallow cloning to properly support optimistic concurrency and transaction isolation in the context of a global object cache
  • Automatic generation of interfaces from the object-relational mapping file.
  • Automatic serialization/deserialization of a persistable object graph

Database Platform Support

  • Configurable ADO.NET data providers with native support for SQL Server 2000 and 2005 (fully implemented), Oracle 10g and 9i (fully implemented) and MySql (partially implemented)
  • Automatic primary key sequence management
  • Support for SQL Server identity columns
  • Conversion of database types to .NET types and vice-versa at runtime. For example, conversion from a .NET enumeration to a database VARCHAR

Object-Relational Mapping

  • Support for 1:1, 1:N and M:N relationship mapping
  • Support for inheritance hierarchy mapping to a single table