Can Fluent nhibernate's automapper be configured to handle private readonly backing fields?

Posted by Mark Rogers on Stack Overflow See other posts from Stack Overflow or by Mark Rogers
Published on 2010-04-12T04:54:35Z Indexed on 2010/04/12 5:03 UTC
Read the original article Hit count: 308

I like private readonly backing fields because some objects are mostly read-only after creation, and for collections, which rarely need to be set wholesale (instead using collection methods to modify the collection).

For example:

public class BuildingType : DomainEntity
{
        /* rest of class */

        public IEnumerable<ActionType> ActionsGranted
        {
            get { return _actionsGranted; }
        }


        private readonly IList<ActionType> _actionsGranted = new List<ActionType>();
        private readonly Image _buildingTile;

        public virtual Image BuildingTile
        {
            get
            {
                return _buildingTile;
            }
        }
}

But as far as I remember fluent-nhibernate's automapper never had a solution for private readonly backing fields, I'm wondering if that's changed in the last few months.

So here's my question:

How do I configure automapper or create an automapping convention to map private readonly backing fields?

© Stack Overflow or respective owner

Related posts about fluent-nhibernate

Related posts about nhibernate