【发布时间】:2015-01-15 22:20:25
【问题描述】:
我正在开发一个现有的应用程序,它首先使用 Generic Repo 模式和 EF6 数据库。 我正在调用一个存储过程,它返回一个复杂类型,该类型在我的实体模型中不是现有实体,因此我不确定要给出什么类型。
这是从我的服务层调用我的 sp 的方式
_unitOfWork.Repository<Model>()
.SqlQuery("sp_Get @FromDateTime, @ToDateTime, @CountyId",
new SqlParameter("FromDateTime", SqlDbType.DateTime) { Value = Request.FromDateTime },
new SqlParameter("ToDateTime", SqlDbType.DateTime) { Value = Request.TripToDateTime },
new SqlParameter("CountyId", SqlDbType.Int) { Value = Convert.ToInt32(Request.County) }
).ToList();
我是否在我的数据层中创建一个实体以映射到,或者存储过程返回复杂类型的最佳方法是什么。 如果是这样,是否需要自定义映射,或者只是创建实体类的一种情况
谢谢
【问题讨论】:
标签: c# entity-framework stored-procedures ddd-repositories