Advertisement
Guest User

Untitled

a guest
May 24th, 2015
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. namespace ExperimentMoq
  2. {
  3. public class DbEntity
  4. {
  5. public int Id { get; set; }
  6. public string Name { get; set; }
  7. }
  8.  
  9. public class CustomDbContext : DbContext, IDisposable
  10. {
  11. public virtual IDbSet<DbEntity> DbEntities { get; set; }
  12. }
  13.  
  14. public class Processor
  15. {
  16. private readonly CustomDbContext _dbContext;
  17.  
  18. public Processor(CustomDbContext dbContext)
  19. {
  20. _dbContext = dbContext;
  21. }
  22.  
  23. public DbEntity Find(int id)
  24. {
  25. return _dbContext.DbEntities.FirstOrDefault(dbEntity => dbEntity.Id == id);
  26. }
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement