?

Log in

Previous Entry | Next Entry

Eager loading is opposite to Lazy loading. If you are new to lazy loading please read c# lazy loading interview question with answers.

In eager loading we load the objects in one go even if the objects are needed or not by the client. For example look at the below c# code. The Customer class has order objects. So the order object is loaded in the constructor, even if the order object is required or not by the UI clients.

public class Customer
{
private List _Orders= null;


public Customer()
{
         _CustomerName = "Shiv";
         _Orders = LoadOrders(); // Loads the address object even though //not needed
       
}
 
private List LoadOrders()
{
         List temp = new List();
         Order o = new Order();
         o.OrderNumber = "ord1001";
         temp.Add(o);
         o = new Order();
         o.OrderNumber = "ord1002";
         temp.Add(o);
         return temp;
}

}

Thanks to questpond.com to provide this c# interview questions with answers.
Copy right www.questpond.com

Buy 600+ Real Time Interview Videos

Call +91-22-66752917 or mail us on questpond@questpond.com for more details on C#, .NET, ASP.NET, SQL Server interview question videos.

SQL Server interview question videos

Latest Month

January 2017
S M T W T F S
1234567
891011121314
15161718192021
22232425262728
293031    

Tags

Powered by LiveJournal.com