The guidance given here http://fluentnhibernate.org/blog/2010/05/23/feature-focus-fields.html suggests that from V1.1 the automapping feature of Fluent NHibernate supports mapping to private fields.
So given the following code, NHiberate should be able to map to the myValue field.
public class SomeEntity
{
private string myValue;
public virtual int Id { get; set; }
}
public class DomainAutomappingConfiguration : DefaultAutomappingConfiguration
{
public override bool ShouldMap(FluentNHibernate.Member member)
{
return (member.IsProperty && member.IsPublic && member.CanWrite) ||
(member.IsField && member.IsPrivate);
}
}
However when I run this code and try to map, I get the following exception:
NHibernate.PropertyNotFoundException : Could not find a getter for property 'myValue' in class.....
I am using FluentNHibernate 1.1 and NHibernate 3.0.0.2001
What am I doing wrong?