AdFactum ObjectMapper .NET Blog

Official blog of the AdFactum ObjectMapper .NET

New Release – AdFactum ObjectMapper .NET 2.0.2129.0

Posted by Gerhard Stephan on October 30th, 2007

Today I’m proud to release version 2.0 of the AdFactum ObjectMapper .NET. This major release covers new key features like a first LINQ implementation, new projection classes and several bug fixes regarding the XML persister.

First of all, the ObjectMapper .NET does now understand the basic LINQ syntax. Please keep in mind that this is a first implementation and that it does not cover the complete functionality of LINQ. But it’s a first step. Be sure that the next release of the ObjectMapper .NET will cover a lot more LINQ features than it does today.

Linq Support

var orders = mapper.Query<Order>();

var customers = mapper.Query<Customer>();


var mexicanOrders =

from order in orders

join customer in customers on order.Customer equals customer

where customer.Country == "Mexico"

select order;


You’ll find several LINQ examples within the NUnit Test Cases.  

Anonymous Types

Because the dotNet Framework 3.0 does now support anonymous types, the AdFactum ObjectMapper .NET had to support these types in order to be LINQ conform.  Have a look at the following LINQ query.

var mexicanOrders =
      from order in orders
      join customer in customers on order.Customer equals customer
      where customer.Country == "Mexico"
select new {
                  order.ShipName };


The result of this query is a list with objects of an anonymous type. The anonymous type has four properties (CompanyName, ContactName, OrderDate and ShipName).

Projection class

The support of anonymous types leads to a new feature of the AdFactum ObjectMapper .NET. It was a absolute necessity to add an equal feature to the non LINQ version. That new feature has been called projection classes. A projection class is a class where the properties are used to mirror the results of multiple sources into one projection. 

     /// <summary>
    /// Class used for projections
    /// A class that is used for projects must not be a ValueObject!
    /// </summary>

    public class OrderCustomer
        private string companyName;
        private string contactName;
        private string shipName;

        /// <summary>
        /// Gets or sets the company name.
        /// </summary>
        /// <value>The company name.</value>
        [ProjectOntoProperty(typeof(Customer), "CompanyName")]
        public int CompanyName
            get { return companyName; }
            set { companyName = value;  }

        /// <summary>
        /// Gets or sets the contact name.
        /// </summary>
        /// <value>The contact name.</value>
        [ProjectOntoProperty(typeof(Customer), "ContactName")]
        public string ContactName
            get { return contactName; }
            set { contactName = value; }

        /// <summary>
        /// Gets or sets the ship name.
        /// </summary>
        /// <value>The name of the ship.</value>
        [ProjectOntoProperty(typeof(Order), "ShipName")]
        public string ShipName
            get { return shipName; }
            set { shipName = value; }


List<OrderCustomer> names = new List<OrderCustomer>(
      new ListAdapter<OrderCustomer>(
            mapper.Select(typeof (OrderCustomer),
            new Join(typeof (Order), “Customer”, typeof (Customer))));


Support of .NET 2003 closed

Because of all these new features and changes it wasn’t possible to keep the .NET 2003 support for the AdFactum ObjectMapper .NET. I hope that not many users are still working with .NET 2003, but there had not been an other solution. Due to this change, it’s necessary to de-install the ObjectMapper .NET first, before installing the new version. 

XML Persister

The Xml Persister has been greatly reworked. It’s now again possible to store object trees into an XML File. I say "again", because this features has been broken in one of the last versions of the AdFactum ObjectMapper .NET.  

Minor Bug Fixes

Last but not least, there have been many minor bug fixes.

  1. There were failures when defining primary keys other than already defined in the base classes, like ValueObject or AutoIncValueObject.
  2. The Access Persister did not throw the correct error number the time a failure occured. This forced the AccessPersister to execute the SQL multiple times before throwing an exception.
  3. Furthermore I implemented a new caching strategy which reduced the amount of cache access significantly.

And a lot of more minor bug fixes / changes that are not counted.

Hope you enjoy the new version.

– Gerhard 

kick it on

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>