Note that there are some explanatory texts on larger screens.

plurals
  1. POFluent NHibernate (ignore a specific property)
    primarykey
    data
    text
    <blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/907576/how-to-tell-fluent-nhibernate-not-to-map-a-class-property">How to tell Fluent NHibernate not to map a class property</a> </p> </blockquote> <p>How can I ignore the property People from being mapped? <b>Code will help</b>. </p> <pre><code>public class Staff : IStaff { public virtual DateTime DateAdded { get; set; } public virtual DateTime DateUpdated { get; set; } public virtual int StaffID { get; set; } public virtual int PersonID { get; set; } public virtual Guid CreatedBy { get; set; } public virtual Guid ModifiedBy { get; set; } public virtual bool IsActive { get; set; } public virtual bool IsDeleted { get; set; } public virtual bool IsATeachingStaff { get; set; } //This is the property I want to exclude from mapping public virtual IPeople People { get; set; } } private static ISessionFactory CreateSessionFactory() { string ConnectionString = "Data Source=DELL;Initial Catalog=University;Integrated Security=True"; return Fluently.Configure() .Database(MsSqlConfiguration.MsSql2008.ShowSql().ConnectionString(ConnectionString)) .Mappings(m =&gt; m.FluentMappings.AddFromAssemblyOf&lt;School.Business.lib.FHibernate.Mapper.PeopleMap&gt;().ExportTo(@"c:\log")) .ExposeConfiguration(BuildSchema) .BuildSessionFactory(); } public class StaffMap : ClassMap&lt;Staff&gt; { public StaffMap() { Table("Staff"); LazyLoad(); Id(x =&gt; x.StaffID).GeneratedBy.Identity().Column("StaffID"); Map(x =&gt; x.PersonID).Column("PersonID"); Map(x =&gt; x.DateAdded).Not.Nullable().Column("DateAdded"); Map(x =&gt; x.DateUpdated).Not.Nullable().Column("DateUpdated"); Map(x =&gt; x.CreatedBy).Not.Nullable().Column("CreatedBy"); Map(x =&gt; x.ModifiedBy).Not.Nullable().Column("ModifiedBy"); Map(x =&gt; x.IsActive).Column("IsActive"); Map(x =&gt; x.IsDeleted).Column("IsDeleted"); Map(x =&gt; x.IsATeachingStaff).Column("IsATeachingStaff"); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload