Can I use private field conventions for Fluent NHibernate Automapping?

How can I map a private field to a white NHibernate AutoPersistenceModel?

public class A { private List<B> myField; public A() { myField = new List<B>(); } public IList<B> MyBs { get { return myField; } } } 

Is there a field model for the AutoPersistence model, or do I need to use separate class mappings for fields?

+4
source share
3 answers

Answer:

It is not possible yet. Maybe I should submit a patch for him ...

+1
source

I know this is not an answer to automatic matching, but to help those who get this search for private field matching.

Now you can use the following code:

 public class A { private List<B> myBs; public A() { myField = new List<B>(); } public IList<B> MyBs { get { return myField; } } } 

With this mapping

 public class AMap : ClassMap<A> { public AMap() { HasMany(x => x.MyBs).Access.CamelCaseField() } } 
0
source

Some time has passed since this question was asked, but it is probably worth publishing this answer if others find this question.

The Fluent NHibernate Wiki provides information on three possible workarounds.

http://wiki.fluentnhibernate.org/Fluent_mapping_private_properties

-2
source

All Articles