That is the cost to pay for a very cool feature in .NET (so far).
Before see the ISet, inside the framework, we had to wait the needs of EF4
(around 9 years).
To have Proxy support inside the .NET perhaps we have to wait others one or
two years.
To have static-proxy directly supported by the compiler (to efficiently
intercept the access to a private field) perhaps in others 4 or 5 years...
if we all don't create enough noise to speed up the change a little bit.

On Tue, Sep 21, 2010 at 1:02 PM, Ayende Rahien <[email protected]> wrote:

> That is pretty much the point.
> There isn't an unproxy stage for an entity with lazy fields.
>
> To give you an example: User.Image is lazy
>
> var user = session.Load<User>(1); // user is a proxy
> NHibernateUtil.Initialize(user); // select id,name from user where id = 1
> var unproxiedUser = ((INHibernateProxy)user).GetImplementation();
>
> unproxiedUser is also proxy, because it need to intercept the get_Image
> call
>
> On Tue, Sep 21, 2010 at 5:43 PM, Allan Ritchie <[email protected]>wrote:
>
>> The problem is more widespread then just the LINQ provider.  You can't
>> unproxy the entity even at later stages outside of the LINQ provider.
>>
>> On Sep 21, 9:18 am, pvginkel <[email protected]> wrote:
>> > I would be very surprised if this really would be a bug, because this
>> > would make the Linq provider unusable when enabling lazy properties.
>> > Feedback is very welcome.
>> >
>> > On Sep 21, 2:36 pm, Allan Ritchie <[email protected]> wrote:
>> >
>> > > I filed this as a bug.  It was claimed not to be a bug which is fine,
>> > > but contrib packages like nhibernate validator seem to fail against
>> > > lazy property proxies because of this exact issue.  Can anyone say
>> > > what the workaround is for this situation?
>> >
>> > > On Sep 20, 7:33 am, pvginkel <[email protected]> wrote:
>> >
>> > > > I have a Linq query which takes an entity as parameter. This entity
>> > > > itself is a proxy loaded with another Linq query and has lazy
>> > > > properties. In "ReflectHelper.cs(267): Assembly assembly =
>> > > > Assembly.Load(name.Assembly);" I get an FileNotFoundException
>> because
>> > > > it tries to load the assembly of the proxy class. It looks like the
>> > > > problem is that
>> NHibernateProxyHelper.GetClassWithoutInitializingProxy
>> > > > can't determine the type of the entity because the proxy does not
>> > > > implement INHibernateProxy, so it returns the type of the proxy.
>> >
>> > > > Is this something I can solve in my configuration, or is something
>> > > > else going on here?
>> >
>> > > > I am using a nightly build of the NH3 trunk.
>>
>
>


-- 
Fabio Maulo

Reply via email to