I have tried using the Reveal property in Fluent but I can\'t get it to compile with a collection. I want one of my collections in an entity to be protected and not accessib
Assuming that Organization has a IList<Trip> the
HasMany<Trip>(Reveal.Property<Organization>("_trips"));
code should work. Check that it's a property and that you have protected getters and setters (privates will not work, since NHibernate will want to proxy the collection for lazyloading).
The simplest answer is to allow the mapping of protected internal virtual properties. This is document in the NHibernate Fluent documentation.
[assembly: InternalsVisibleTo("MyDomain.mapping")]
where the string is the namespace of the mapping.create properties with the protected internal virtual access declarations.
protected internal virtual IList<Clinician> __AppointmentMemberAttendees { get; set; }
Map items just like normal.
HasManyToMany(x => x.__AppointmentMemberAttendees)
.Table("__AppointmentToAttendeesMember")
.Cascade.None();