Really want to reveal my private member

182 views
Skip to first unread message

acl123

unread,
Sep 9, 2010, 5:09:57 AM9/9/10
to Fluent NHibernate
All jokes aside, I'm trying to reveal a private member inside a
component like this:

Component(x => x.Foo,
part =>
{
part.Map(x => x.Bar, "FooBar");
part.Map(Reveal.Member<Foo>("_baz"), "FooBaz")
.Nullable();
});

The mapped component class looks like this:
public class Foo
{
private short? _foo;
public int Bar { get; set; }
}

I am receiving the error:

FluentNHibernate.Cfg.FluentConfigurationException : An invalid or
incomplete configuration was used while creating a SessionFactory.
Check PotentialReasons collection, and InnerException for more detail.

----> NHibernate.PropertyNotFoundException : Could not find a getter
for property '_baz' in class 'MyNamespace.Foo'


This is using Fluent NHibernate 1.1 which I understand handles
revealing private fields.

Thoughts?

James Gregory

unread,
Sep 9, 2010, 5:24:46 AM9/9/10
to fluent-n...@googlegroups.com
Try adding Access.Field to your Map call. It shouldn't be necessary, but it's worth a try.

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

acl123

unread,
Sep 9, 2010, 10:05:21 PM9/9/10
to Fluent NHibernate
Yes that works thanks!
Actually I had already tried Access.CamelCaseField, but that doesn't
work.


On Sep 9, 7:24 pm, James Gregory <jagregory....@gmail.com> wrote:
> Try adding Access.Field to your Map call. It shouldn't be necessary, but it's worth a try.
>

James Gregory

unread,
Sep 10, 2010, 6:36:40 AM9/10/10
to fluent-n...@googlegroups.com
Access.CamelCaseField instructs NH to take the name of a property, make it camel case, and use that as the name of the field. When you're actually pointing it directly at a field, you just need Access.Field
Reply all
Reply to author
Forward
0 new messages