views:

195

answers:

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:

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'. 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). 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. However, I'm definitely open to any advice.

+3  A: 

Here's the change and here's the reason for that change. According to the report, it was breaking proxy behavior.

Mauricio Scheffer
Nice one. I guess the forced exposure of members in this case is a downside to using proxies in general. Thanks.
Brendan Kowitz