2006-08-28

NHibernateUtil.IsInitialized()

I have a nhibernate lazy loaded collection, well a bunch of them in a tree of parent-child relations. When i save some nodes, i have to loop over the active nodes and add a bit of data to them. Trouble is when i access the parents/children it initilises the collections. This is bad as it then loads the whole tree into memory on the saved.
I thought there must be a way to check whether a collection had been loaded lazyily. First i thought about checking the type to see if it was the dynamic proxy. But then ran into this gem at the nhibernate reference guide:
http://www.hibernate.org/hib_docs/nhibernate/html/performance.html

I could just pass the collection to this method, and it would check if it had been initialised. Just waht i was after. The only other place i found a reference to this function then was at the forums:
http://forums.hibernate.org/viewtopic.php?p=2282177&sid=b5989f2c3f2387add4188a6e13802019

So why dao function ended up as, because i dont want the nhibernate logic permeating my service layer:

        public bool HasBeenInitialised(ICollection collection) {
            return NHibernateUtil.IsInitialized(collection);
        }

9 comments:

List Forever said...

Fastest Cars In The World We can measure automotive excellence in several ways, but top speed which a automobile can achieve is the one everyone secretly cares about the most

Unknown said...

"This photo is perfect except for background which is...". Well, let's say "bad". Have you ever thought like that? Probably, you even made an attempt or two to edit the picture with the ruined Photo Background Editor, to no avail. Surely, not all of us are designers or at least IT savvy. So, here is a way for the rest of humanity to change the back scene of any photograph – the Photo Scissors online tool.

Unknown said...

Nearbest10 is a participant in the Amazon Services LLC Associates Program which is an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com. Amazon, the Amazon logo, AmazonSupply, and the AmazonSupply logo are trademarks of Amazon.com, Inc. or its affiliate.

Gypsum Designer said...

Gypsum designer providing innovative building solutions to meet the demands of customers for sustainable performance solutions. Gypsum designer Inc. is a key resource for architects, contractors, and design professionals.

WORLD NEWS said...



Clipping path service is one kind of image editing Process where we select a important portion of an image and cut the unimportant part Clipping path We can delete the background or change background color to make it more attractive.

Image Masking said...


Image masking is a powerful background changer while clipping method does not work.Image Masking This process is used to change or remove the background of an image of a target object which has hairy, fuzzy or soft edge like a dog or curly hair of a girl or transparent background like glass.

yanmaneee said...

christian louboutin shoes
air jordans
golden goose sneakers
nike off white
nike kd 12
yeezy boost
jordan shoes
supreme new york
nike air vapormax
christian louboutin outlet

WORLD NEWS said...

Clipping path service is one kind of image editing Process where we select a important portion of an image and cut the unimportant part Clipping path We can delete the background or change background color to make it more attractive.

yanmaneee said...

yeezys
yeezy
supreme
goyard
goyard tote
balenciaga
golden goose outlet
supreme outlet
adidsas yeezy
adidas yeezy