It works if you expose a public getter property that has a private
backing field.

Assuming an entity type

"Order"
with public property "public int Total { { return _total; } }"
with  backing field "private int _total;"

You can do this:

AutoPersistenceModel.Override<Order>(map => map.References(x =>
x.Total).Access.ReadOnlyPropertyThroughCamelCaseField(Prefix.Underscore))

--Jeff


On Apr 12, 8:51 am, m4bwav <m4b...@gmail.com> wrote:
> Found the answer, there is no direct support for readonly backing
> fields in the fluent nhibernate auto-mapper.
>
> On Apr 12, 12:00 am, m4bwav <m4b...@gmail.com> wrote:
>
> > I posted this question on stack 
> > overflow:http://stackoverflow.com/questions/2619954/can-fluent-nhibernates-aut...
>
> > On Apr 11, 11:33 am, m4bwav <m4b...@gmail.com> wrote:
>
> > > Oh nevermind support forum is not functioning until the April 16th.
> > > So I will see if I can game an answer here.
>
> > > Not my bad,
> > > Mark
>
> > > On Apr 11, 11:31 am, m4bwav <m4b...@gmail.com> wrote:
>
> > > > Sorry I just read the message about the support forum, I'll repost the
> > > > question there.
>
> > > > My Bad,
> > > > Mark
>
> > > > On Apr 11, 11:28 am, m4bwav <m4b...@gmail.com> wrote:
>
> > > > > Hey, love Fluent nhibernate, thanks for the work, quick question.
>
> > > > >   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?
>
> > > > > Thanks,
> > > > > Mark
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To post to this group, send email to fluent-nhibern...@googlegroups.com.
To unsubscribe from this group, send email to 
fluent-nhibernate+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/fluent-nhibernate?hl=en.

Reply via email to