EF UnitTesting Data Repository


/ Published in: C#
Save to your folder(s)



Copy this code and paste it in your HTML
  1. public class ProductDataRepository : IProductDataRepository
  2. {
  3. private MyDatabase_ModelContainer _model;
  4. protected internal MyDatabase_ModelContainer Model {
  5. get {
  6. if (_model == null) {
  7. _model = new MyDatabase_ModelContainer();
  8. }
  9. return _model;
  10. }
  11. }
  12.  
  13. public IQueryable<Product> GetProducts() {
  14. return Model.Products.Where(p => p.IsDeleted == false);
  15. }
  16. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.