c# - Can I derive from IBindingList to facilitate lazy loading in NHibernate? -


I obtained a 3-party WinForms grid from a database to NHibernate using the lingering load from the IBindingList for the database I am using the class.

At present, for working on lazy loads, I need to keep an NH session open at all times so that when the user clicks on a new line in the grid, then to load the rest A session is available to select the object graph for the object.

However, many people suggest that this is bad behavior.

So, I'm thinking that I can hook up in IBIDIL, in any way to prevent data fetching from the grid, and to create and discard the session on the fly.

The object was in the browser, and the only thing that looked convenient was to override the indexer ("this [int]") in ILISIL and LT. T & gt;

Is this a viable approach, or is there a better way?

One of the best ways I've proposed for you is that I used it already, I suggest defining the "page" size, and load a full page in the indexer if not yet cached. SetMinResult, Use SetMax to keep records of the pages, and keep an undelyng dictionary of the pages already present. Some small hacks to remember: When you change the sort / filter, remove all the item cache I wrote a post about my solution here:

This is not correct but work;) You can find some more examples (I think) in U

Comments