Created
September 12, 2012 10:21
-
-
Save RemiBou/3705772 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CustomerController : Controller | |
{ | |
private IMyDbContext _dbContext; | |
public CustomerController(IMyDbContext dbContext) | |
{ | |
_dbContext = dbContext; | |
} | |
public ActionResult Index() | |
{ | |
return View(_dbContext.Customers.OrderBy(c => c.Name).ToList()); | |
} | |
} | |
public interface IMyDbContext | |
{ | |
IQueryable<Customer> Customers { get; set; } | |
} | |
public class MyDbContext : IMyDbContext,DbContext | |
{ | |
public IQueryable<Customer> Customers { get; set; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment