Directory:DataObjects.net

MyWikiBiz, Author Your Legacy — Tuesday November 05, 2024
Revision as of 01:19, 29 May 2009 by MyWikiBiz (talk | contribs) (De-bold some of lead)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Template:Infobox Software

DataObjects.Net is a rapid database application development framework.

It combines comprehensive business logic layer (BLL) development framework, object-relational mapper (ORM) and a set of storage implementations enabling the same BLL code work everywhere reducing the resources and time you need to develop generally any application dealing with persistent data.

Besides other features, DataObjects.Net has built-in embedded database, so it can be used both with and without SQL database.

DataObjects.Net is true open source product available under GPL and commercial licenses. The most current version is 4.0.

History

First version of DataObjects.Net was initially designed in 2003 for use in rather special set of cases, mainly – in web-based document management systems. DataObjects.Net 1.0 was developed in ~9 months by a 3-person team. Many its limitations appeared just because authors didn’t though it will be practically useful in much wider set of cases. An example of such limitation is pre-defined type of identifier and version. Nevertheless its initial design was innovative for that period - in comparison to other persistence frameworks on the market. Finally the team of developers has made a decision to completely redesign it. This new implementation is known as DataObjects.Net v4.0.

Works on DataObjects.Net v4.0 were started in the beginning of 2007. In September 2008 v4.0 was publicly shown for the first time, although some features (LINQ, schema evolution) were missing in it yet. DataObjects.Net v4.0 final has been released in May 2009.

Features

  • Next level of storage independence. DataObjects.Net allows to transparently migrate between SQL database and index storages. This is the only OR/M framework supporting non-SQL databases at all.
  • Designed for frictionless development of business logic layer (BLL) components providing modularity, reusability, testability for them.
  • OR/M layer providing support for:
    • Class mapping: framework supports 3 common mapping strategies: class to table, class to concrete table, hierarchy to table. So inheritance is fully supported.
    • Interface mapping: DataObjects.Net is capable of mapping interfaces to materializing tables, as well as to ordinary tables, to which Entities implementing the interface are mapped. Materializing tables can be indexed.
    • Structures: struct-like objects that Entities may aggregate.
    • Arbitrary primary key types, combined primary keys
    • Indexes
    • LINQ.
  • Mappings and other aspects of Domain model are described by attributes, although it is possible to configure them using a special API. Mappings are established even if only basic attributes are applied.
  • Framework automatically creates, and, if necessary, upgrades the schema on each Domain startup preserving all the data. The upgrade process is fully customizable.
  • "Unit-of-work" pattern implementation and error compensation based on integrated Atomicity framework.
  • Support for master-slave and P2P synchronization scenarios between storages running DataObjects.Net out of the box.
  • High performance. The framework was initially designed for performance. For example, it intensively uses caching. In particular, query compilation and optimization results, compiled expressions, keys and fetched entities are cached.
  • Embedded database supporting all the features listed above (indexes and including LINQ) allows to use the product without any SQL database at all.
  • Relying on PostSharp while implementing persistent properties and overriding persistent object's behavior in AOP fashion.

Example

Persistent entity: <source lang="CSharp"> [HierarchyRoot(typeof(KeyGenerator), "Id")] public class Message : Entity {

[Field]
public int Id { get; private set; }
[Field(Length = 1024)]
public string Text { get; set; }

} </source>

Confuguration: <source lang="XML"> <Xtensive.Storage>

<domains>
  <domain name="memory" connectionUrl="memory://localhost/Tests" upgradeMode="Recreate" />
  <domain name="mssql"  connectionUrl="mssql2005://localhost/Tests" upgradeMode="Recreate" />
  <domain name="pgsql"  connectionUrl="pgsql://tester:testpwd@localhost:8332/test?Encoding=ASCII" upgradeMode="Recreate" />
</domains>

</Xtensive.Storage> </source>

Building domain: <source lang="CSharp"> var configuration = DomainConfiguration.Load("mssql"); configuration.Types.Register(typeof(Message).Assembly); var domain = Domain.Build(configuration); </source>

Creating entity: <source lang="CSharp"> using (domain.OpenSession()) {

using (var transactionScope = Transaction.Open()) {
  var message = new Message() {
    Text = "Hello World!"
  };
  transactionScope.Complete();
}

} </source>

Query: <source lang="CSharp"> using (domain.OpenSession()) {

using (var transactionScope = Transaction.Open()) {
  // This query will be translated to ~ SELECT ... WHERE message.Text LIKE "Hello%"
  var helloMessages =
    from message in Query<Message>.All
    where message.Text.StartsWith("Hello")
    select message;
  foreach (var message in helloMessages) // Actual execution happens here
    Console.WriteLine(message.Text);     // Prints "Hello World!"
  transactionScope.Complete();
}

} </source>

Architecture

File:DataObjects.Net Framework Architecture.png

External links