We’re using Fluent Nhibernate and I can’t seem to map a component. My component class isn’t an entity and has two values:
public class Member
{
public int ID;
public string Name;
}
The parent entity is mapped to a view with two columns to fill the two properties. I map the class as a component using Linq as:
Component(x => x.CurrentMember, m =>
{
m.Map(x => x.ID, "MemberId");
m.Map(x => x.Name, "MemberName");
});
When I run this I get FluentNHibernateConfigurationException building the SessionFactory: “Could not find a getter for property ‘ID’ in class ‘Member”. This isn’t an entity so I’m a little confused as to what I’m missing?
Well your class doesn’t specify a property called
ID– it specifies a field. Perhaps you should try giving your class properties rather than public fields: