向所有人致意 我正在使用工作单元,存储库模式与实体框架6(代码优先方法)以及依赖注入, 我已扩展我的存储库以执行以下存储过程 public List< tentity> ExecuteStoreProcedure(IUnitOfWork unitofWork,string spName,params object [] parameters) { return((DataContext)unitofWork.getDBContext())。Database.SqlQuery< tentity>( spName,parameters)。ToList(); } 我的问题是。 1.如何使用这种设计模式调用我的调用我的存储过程(我正在做的是正确的)。 2.如何让实体框架生成类来保存来自我的存储过程的数据(< tentity>)。 a)我有很多存储过程,我不想为所有这些创建POCO类。
Greetings to all I am using unit of work, repository pattern with entity framework 6 (code first approach) along with dependency injection, I have extended my repository to execute stored procedures as below public List<tentity> ExecuteStoreProcedure(IUnitOfWork unitofWork, string spName, params object[] parameters) { return ((DataContext)unitofWork.getDBContext()).Database.SqlQuery<tentity>(spName, parameters).ToList(); } my questions are. 1.How can I call my call my stored procedures using this design pattern(is what I am doing is correct). 2.How can I make entity framework generate classes to hold the data from my stored procedures on the fly(<tentity>). a) I have lots of stored procedures and I do not want to create POCO classes for all of them.
推荐答案你好Vailbhav Nigam。 如果你免费那么你可以查看以下链接 www.remondo/repository -pattern-example-csharp / [ ^ ] Hi Vailbhav Nigam. If u r Free then u can checkout the below link www.remondo/repository-pattern-example-csharp/[^]
更多推荐
使用实体框架6中的工作单元和存储库模式调用存储过程。
发布评论