I have a class that is mapped in fluent nhibernate but I want one of the classes properties to be ignored by the mapping.
With class and mapping below I get this error:
*The following types may not be used as proxies: iMasterengine.Data.Model.Calendar: method get_HasEvents should be virtual*
//my class
public class Calendar : IEntity {
public virtual int Id { get; private set; }
public virtual string Name { get; set; }
public virtual string SiteId { get; set; }
public virtual IList<CalendarEvent> Events { get; set; }
//ignore this property
public bool HasEvents { get { return Events.Count > 0; } }
}
//my mapping
public class CalendarMap : ClassMap<Calendar> {
public CalendarMap() {
Id(x => x.Id);
Map(x => x.Name);
Map(x => x.SiteId);
HasMany(x => x.Events).Inverse();
//what do I put here to tell nhibernate
//to ignore my HasEvents property?
}
}