Can automapper handle private readonly backing fields?

m4bwav's Avatar

m4bwav

11 Apr, 2010 07:49 PM via web

I like private readonly backing fields because some objects are mostly read-only after creation, and for collections, which should
almost never be set wholesale (seems like, since there are add and
remove item methods). 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?

  1. 2 Posted by m4bwav on 12 Apr, 2010 03:52 PM

    m4bwav's Avatar

    Answer found.

    There is no support for readonly backing fields in the fluent nhibernate auto-mapper

  2. Support Staff 3 Posted by James Gregory on 16 May, 2010 05:42 PM

    James Gregory's Avatar

    This is now supported in the latest version. By default it'll map them as nosetter.camelcase or backfield depending on whether they're an autoproperty. Failing that, you can also override the ShouldMap(Member) method in your IAutomappingConfiguration to explicitly map those members.

  3. 4 Posted by m4bwav on 19 May, 2010 02:14 PM

    m4bwav's Avatar

    Hey, thanks a lot! Your the man!

  4. James Gregory closed this discussion on 19 May, 2010 02:21 PM.

Comments are currently closed for this discussion. You can start a new one.