Linked by Eugenia Loli-Queru on Wed 12th Dec 2007 05:47 UTC, submitted by LinucksGirl
Permalink for comment 290125
To read all comments associated with this story, please click here.
To read all comments associated with this story, please click here.




Member since:
2006-01-23
Its very useful, I use it a lot for properties on objects (yes I'm a .net programmer don't kill me) where data needs to be fetched from the database as the data isn't needed everytime the class is instantiated. The secret isn't to do it to everything (you don't want to hammer the database and the overhead on getting the data may cost more than the data). I usually do it for big things like binaries in database. Specificly I used to maintain a web application that stored word documents in the database. Now a word file wasn't all that big, but if I were to get a colletion of, lets say, all the articles in the database it would take quite a while to get all the data, so I used lazy loading on the file blog:
private byte[] fileBlob;
public byte[] FileBlob
{
get
{
if (fileBlob == null) fileBlog = GetFileBlob();
return fileblob;
}
}
Also, I have my default view set to threaded and I can't make a post if there aren't other comments already. This is very annoying as I have to set my default to flat everytime I post to an article with no comments yet.
Edited 2007-12-12 06:10