With EF 4.1 and greater, you just need to make sure to define your code-first navigation properties (properties that link to other entities) as virtual. Then, if you are inside a DbContext, the linked entity will only be queried from the database when it is actually used (lazy loaded).
However, eager loading is used when you want all the data right away. There are usually good reasons for this. So, I would first say that if you don't know why you are eager loading, then don't do it. Make sure your properties that link entities are virtual and then get rid of the .Include statements in your query.
However, if you are taking the data you are querying outside of a DbContext or you use the data right away it makes sense to pull that data into memory for the duration of your operation.
So, in response to your question, it is not always a case of just replacing eager loading with lazy loading. You must look at what is being done with the data once it is queried and see how to only return the minimum set you need.
Added example:
public class Person
{
public int Id { get; set; }
public string Name { get; set; }
public virtual ICollection<Car> Cars { get; set; } //make it virtual
}
public class Car
{
public int Id { get; set; }
public string Make { get; set; }
public string Model { get; set; }
}
public class MyContext : DbContext
{
public IDbSet<Person> People { get; set; }
public IDbSet<Car> Cars { get; set; }
}
class Program
{
private static void Main(string[] args)
{
using (var context = new MyContext())
{
var person = context.People.FirstOrDefault(p => p.Id == 1); // calls the database
var car = person.Cars.FirstOrDefault(c => c.Id == 2); // Lazy loads Cars
}
}
}