views:

36

answers:

1

For our grid views, we're setting the data sources as a list of results from an Nhibernate query.

We're using lazy loading, so the objects are actually proxied... most of the time.

In some instances the list will consist of types of Student and Composition_Aop_Proxy_jklasjdkl31231, which implements the same members as the Student class.

We've still got the session open, so the lazy loading would resolve fine, if GridView didn't throw an error about the different types in the gridview.

Our current workaround is to clone the object, which results in fetching all of the data that can be lazily loaded, even though most of it won't be accessed.. ever. This, however, converts the proxy into an actual object and the grid view is happy. The performance implications kind of scare me as we're getting closer to rolling the code out as is. I've tried evicting the object after a save, which should ensure that everything is a proxy, but this doesn't seem like a good idea either.

Does anyone have any suggestions/workarounds?