AdFactum ObjectMapper .NET Blog

Official blog of the AdFactum ObjectMapper .NET

Archive for November, 2007

Attribute: [ProjectOntoProperty]

Posted by Gerhard Stephan on 12th November 2007

The attribute [ProjectOntoProperty] is used to build projections of distinct source tables.


  1. A projection is a result subset of the queried tables.
  2. A projection can be used as a query result, instead of quering an IValueObject type.

That implicates, that a projection class (that uses the ProjectOntoProperty) must not implement the IValueObject interface.


Imagine you would have two value object types: A Company with their employees. Now you wanto to query the employees. As an additional information you want to output the name of the company where the employees are working. Because of this, you would have a a result type that is compound of the type company and employee.

List<FullFeaturedEmployee> names = new List<FullFeaturedEmployee>(

      new ListAdapter<FullFeaturedEmployee>(



                  new CollectionJoin(







    /// <summary>

    /// Projects results of the company legalname and the employee names

    /// </summary>

    public class FullFeaturedEmployee


        private int companyId;

        private int employeeId;


        private string companyName;

        private string firstName;

        private string lastName;


        [ProjectOntoProperty(typeof(Company), "LegalName")]

        public string CompanyName


            get { return companyName; }

            set { companyName = value; }



        [ProjectOntoProperty(typeof(Employee), "FirstName")]

        public string FirstName


            get { return firstName; }

            set { firstName = value; }



        [ProjectOntoProperty(typeof(Employee), "LastName")]

        public string LastName


            get { return lastName; }

            set { lastName = value; }



        [ProjectOntoProperty(typeof(Company), "Id")]

        public int CompanyId


            get { return companyId; }

            set { companyId = value; }



        [ProjectOntoProperty(typeof(Employee), "Id")]

        public int EmployeeId


            get { return employeeId; }

            set { employeeId = value; }





A projection class (that uses the ProjectOntoProperty) must not implement the IValueObject interface.

Posted in Attributes | No Comments »

Public Holiday Toolkit v1.0

Posted by Gerhard Stephan on 2nd November 2007

Today the Public Holiday Toolkit v1.0 has been published. The Toolkit enables the developer to show public holidays for several countries within .NET applications. So why do I post it here? Because the Public Holiday Toolkit is based on the AdFactum ObjectMapper .NET. That makes it to a perfect example for how to use the XML Persister. Furthermore the model can be perfectly adapted into your own entity model, in order to store the holiday definitions into a real database, instead of using an XML file.

So have fun with it.

– Gerhard

Here’s the URL: Public Holiday Toolkit v1.0

Posted in Miscellaneous | No Comments »