Thursday 15 September 2011

c# - when should I use lazy load and how lazy it should it be -


I want to ask about lazy loading. I have often read that we should reject it, but why should I load the data which is probably never done?

Let us use the customer as an example of discussion:

  --ind-title - form of another name - first name - tagname - Illustration * -OobBeon -Mobile-Address * / Billing Address * -Id -Street -Number-Country * -Id -Name -Jipcode -Bank-Details * - ID-Account Holder- Account Number -Bank * -Id-Name - BankCode -IBN   

marks the object which I load lazily in accordance with the motto "Loads only what you want Hia ".

Edit

Okay, my question is not quite clear, so here it is better to know what I want to know:

I want to know Why is it that most people have to stop lazy loads, is it because they can not use it or there are very bad damages?

Using the form of a tuning mechanism is normal, for example if you are loading all the data And if you are not seeing any display problems, then the truth is that you probably do not have to worry about yourself with a little complexity of lazy load patterns.

However, if you are considering issues of performance, then you should keep track of the patterns, recognize the most commonly used data (as you have written above the figures marked with *), and You have only loaded that data. To determine, you will need some performance analysis or not, when you need additional data (which is not marked by *), decreases the performance of the system / slows down any other operations in the same domain (Which depend on or relate to the operation you are describing)

If you are using .NET 4.0 (and above), then Lazy & Lt; T & gt; Can help to reduce some complexity in implementing lazy load, even for thread protection!)

No comments:

Post a Comment