AdFactum ObjectMapper .NET Blog

Official blog of the AdFactum ObjectMapper .NET

Attribute: [ProjectOntoProperty]

Posted by Gerhard Stephan on November 12th, 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.

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>