I understand that EF 5 will automatically cache the queries, but does it do it per context or overall? We are using MVC and are wrapping the calls in a using block to dispose of the dbcontext. For example:

public class Employee
{
    public string FirstName {get; set;}
    public string LastName {get; set;}
    public int ID {get; set;}
}

public class EmployeeQueryByFirstName : IQueryObject<Employee>
{
     private string _firstName;

     public void Set(string FirstName)
    {
         _firstName = FirstName;
    }

     public Expression<Func<Employee,bool>> AsExpression()
    {
        return (e=>e.FirstName == this._firstName);
    }
}

public class RepoExcerpt
{
    public TEntity Find<TEntity>(IQueryObject<TEntity> queryObject)
        where TEntity : class
    {
        using (var conn = ServiceLocator.IOC.Resolve<IDbContext>())
        {
            var query = (from q in conn.Set<TEntity>()
                        select q);
            query = query.Where(queryObject.AsExpression());
            return query.FirstOrDefault();
        }
    }
}

The next time we call Find on the repository, will EF 5 have a cached version of this query, or will it be gone because we will be getting a new dbcontext? And if I want cached queries, will I need to handle that?

Edit
Report