エンティティ間の関係が必要なので、NHibernateでsetterでmapプロパティを無視する必要があります。 {取得;}私は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);
});
}
}
私は、プロパティ資格を残す場合ことを知っています。
ありがとうございます。
感謝しますが、今、それは次のようなエラーが判断できませんでしたスロータイプ:MyApp.Credential、MyApp、Version = 1.0.0.0、Culture =ニュートラル、PublicKeyToken = null、列:NHibernate.Mapping.Column(Credential) –