Not a bug per se - RejectReason is visible to your mapping code, but not
to NHibernat. Assuming that your assembly's signed I suspect (haven't
tried) that you could use the [assembly: InternalsVisibleTo("NHibernate,
...")] annotation in AssemblyInfo.cs to permit NHibernate to access the
internal members.
/Pete
From: [email protected] [mailto:[email protected]] On
Behalf Of Michael Logutov
Sent: 14 June 2013 07:57
To: [email protected]
Subject: [nhusers] Exception when mapping by code internal properties.
I have this simple class:
public class Spare : Entity
{
protected internal virtual string RejectReason { get; protected
set; }
}
And when I try to map it with this:
internal class SpareMap : ClassMapping<Spare>
{
public SpareMap ()
{
this.Table ("Spares");
this.Id (x => x.Id, map => map.Generator
(Generators.Identity));
this.Property (x => x.RejectReason);
}
}
I got exception:
System.ArgumentNullException: Value cannot be null.
Parameter name: localMember
But it's all work ok with mapping like this:
this.Property ("RejectReason", map => map.Access (Accessor.Property));
Which is clearly not the way I want mapping by code look like (all those
magic strings even if I have access to the property).
I've also tries making the field internal (without protected) and tried
specifying various access rights with the first mapping example - still
no luck.
It's a bug?
--
You received this message because you are subscribed to the Google
Groups "nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/groups/opt_out.