Repository Pattern - POCOs or IQueryable?

前端 未结 2 1832
北恋
北恋 2021-02-07 20:25

I\'m new to the Repository Pattern and after doing a lot of reading on the web I have a rough understanding of what is going on, but there seems to be a conflict of ideas.

2条回答
  •  日久生厌
    2021-02-07 21:05

    I use the same pattern as you do. I like it a lot. You can get your data from any resources.

    But the advantage of using IQuerable is that you do not have to code your own criteria API like the OrangeCriteria.

    When NHibernate gets full Linq support then I may switch to the IQueryable.

    Then you get

    public class OrangeRepository: IOrangeRepository {  
        public IQueryable GetOranges();
    }
    

提交回复
热议问题