Possible to use the Repository Pattern + Stored Procedures ? Should / can they return IQueryable?

▼魔方 西西 提交于 2019-12-06 00:17:16

I would suggest going ahead and doing just that. Setup the stored procedure in the EF model, returning whichever entity it needs to, then in your repository create a get that addresses what the stored procedure is using. The difference in how the data is returned is occurring inside your DAL (in this case the EF model), your repository is still accessing a context to find and return data.

I am doing something similar right now and that was the best solution I could come up with. It allowed me to continue doing my data access at the EF Model and keep my repository separated from the way the model is collecting the data. The repository is still clueless about how the model gets the data and the rest of the app won't see anything different about the repository functions.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!