简体   繁体   English

NHibernate代理验证器在2.1中的更改

[英]NHibernate Proxy Validator changes in 2.1

Can someone please help me understand the following: 有人可以帮助我了解以下内容:

In the previous version of NHibernate (2.0.1) the following property will validate and is compatible with the Castle Proxies: 在早期版本的NHibernate(2.0.1)中,以下属性将验证并与Castle Proxies兼容:

internal virtual BusinessObject Parent
{
  get { /*code*/ }
}

However, in 2.1 it errors saying that the types should be 'public/protected virtual' or 'protected internal virtual'. 但是,在2.1中错误地指出类型应该是“公共/受保护的虚拟”或“受保护的内部虚拟”。 I have issues with this because marking a property with 'protected internal' exposes the property to inherited types in OTHER assemblies (effectively protected OR internal). 我对此有疑问,因为用“受保护的内部”标记属性会使该属性暴露于其他程序集中的继承类型(有效受保护的OR内部)。 Given that this was never a requirement before, it feels like a bit of a bad requirement to impose now. 鉴于以前从未有过这样的要求,现在强制实施似乎有点不好。

Can someone please explain why this requirement is now there and what it is trying to enforce so I can at least understand what it is intending to achieve. 有人可以解释一下为什么现在存在此要求以及它要强制执行什么,以便我至少可以了解它打算实现什么。

If this restriction is not entirely needed, and I am 100% certain these types of properties will NEVER map to DB properties I am intending to create my own Mashup ByteCode provider using the Castle proxy factory and the Type Validator from 2.0.1. 如果不是完全需要此限制,并且我100%确信这些类型的属性将永远不会映射到数据库属性,我打算使用Castle代理工厂和2.0.1版中的类型验证器来创建自己的Mashup ByteCode提供程序。 However, I'm definitely open to any advice. 但是,我绝对愿意接受任何建议。

Here's the change and here's the reason for that change. 这是更改这是更改 的原因 According to the report, it was breaking proxy behavior. 根据该报告,它破坏了代理行为。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM