[英]Unproxy property mapping nhibernate
you can put a property without a proxy? 你可以不用代理就可以放财产吗? because I need to get the value of it.
因为我需要获得它的价值。 Below is the mapping:
下面是映射:
public class MateriaPrimaMap : ClassMap<MateriaPrima> {
#region Construtor
public MateriaPrimaMap() {
Table("MATERIAPRIMA");
Id(m => m.Id).Column("MPR_CD");
Map(m => m.Descricao)
.Column("MPR_DS")
.Not.Nullable().Length(30);
Map(m => m.Ativo)
.Column("MPR_ATIVO")
.Not.Nullable();
Version(m => m.Version).Column("MPR_DT_LK").Generated.Always();
}
#endregion
}}
You can use the mapping of NHibernate, which let's you map a property of another entity (related with the main one) as if it were part of it. 您可以使用NHibernate的映射,这使您可以映射另一个实体(与主实体相关)的属性,就好像它是其中的一部分一样。 See here: http://nhibernate.info/doc/nhibernate-reference/mapping.html#mapping-declaration-join .
参见此处: http : //nhibernate.info/doc/nhibernate-reference/mapping.html#mapping-declaration-join 。
If you have a proxy, you can get the identifier using INHibernateProxy
reference here . 如果您有代理,则可以使用
INHibernateProxy
reference here来获取标识符。
If you do not what to deal with proxies, just add an additional properties and map them, be sure to use .Not.Insert().Not.Update()
to avoid mapping problems. 如果不处理代理,只需添加其他属性并映射它们,请确保使用
.Not.Insert().Not.Update()
以避免映射问题。
Map(m => m.DescricaoId)
.Column("MPR_DS")
.Not.Insert().Not.Update();
Map(m => m.AtivoId)
.Column("MPR_ATIVO")
.Not.Insert().Not.Update();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.