我需要在NHibernate中用setter忽略映射屬性,因爲需要實體之間的關係。這是我簡單的模型我如何忽略NHibernate中的映射屬性設置器
public class Person
{
public virtual Guid PersonId { get; set; }
public virtual string FirstName { get; set; }
public virtual string SecondName { get; set; }
//this is the property that do not want to map
public Credential Credential { get; set; }
}
public class Credential
{
public string CodeAccess { get; set; }
public bool EsPremium { get; set; }
}
public sealed class PersonMap : ClassMapping<Person>
{
public PersonMap()
{
Table("Person");
Cache(x => x.Usage(CacheUsage.ReadWrite));
Id(x => x.Id, m =>
{
m.Generator(Generators.GuidComb);
m.Column("PersonId");
});
Property(x => x.FirstName, map =>
{
map.NotNullable(true);
map.Length(255);
});
Property(x => x.SecondName, map =>
{
map.NotNullable(true);
map.Length(255);
});
}
}
我知道,如果我離開的財產憑證{獲得;}我不打算採取的NHibernate的地圖,但我需要設置我的經營業務邏輯的價值。
在此先感謝。
感謝,但現在它引發以下錯誤無法確定類型爲:MyApp.Credential,MyApp,Version = 1.0.0.0,Culture = neutral,PublicKeyToken = null,用於列:NHibernate.Mapping.Column(憑據) – 2012-03-24 16:56:17