Guys,
We've been quite regularily receiving requests and/or complaints about not
being able to map private and protected properties. I think we all know why
this isn't possible, and I think we're mostly in agreement that allowing
this is kinda against the purpose of Fluent NHibernate; however, people
still want it. I think it was Chad who suggested that we could supply some
alternative methods that take strings as parameters, as a way to make it
possible but not as intuitive as the lambda mappings (with the purpose of
making people use the lambdas whenever possible, rather than seeing the
lambda parameter and the string parameter and taking the one they know best
- the string).

I had an idea of an alternative, and I've knocked up a few tests and it
seems to work.

Map(Reveal.Property<Entity>("PrivatePropertyName"));
HasMany(Reveal.Property<Entity>("PrivateCollection"));

The Reveal in those statements is a static class, and the Property method
takes a property name and a generic type parameter of the entity being
mapped. It then does some expression magic and builds up an
Expression<Func<Entity, object>> object. This essentially allows us to leave
the mapping completely untouched. No overloads/alternatives for every
method, no maintenance nightmare. If people want to use it, they're welcome
to, but the default route is still the lambda expressions.

Any thoughts? I've tested this against Map and HasMany, and I haven't had
any trouble, will test everything else before releasing though.

James

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To post to this group, send email to fluent-nhibernate@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