Pur*_*ome 5 .net stored-procedures entity-framework poco entity-framework-4
我有一个非常简单的实体框架项目与POCO实体.我有一个stored procedure我用它导入的单曲EF Wizard.KEWL.
然后我做了我自己的EF Entity,然后我把它Add Function Import映射Stored Procedure到我的EF Entity.
现在......我不知道如何将我映射EF Entity到一个POCO.因此,我不断收到以下错误:
错误11007:未映射实体类型"XXXXX".
我不知道如何将这个实体映射到一个POCO.有人可以帮忙吗?
S'Ok.这就是我最终做的事情.
IE浏览器.的.edmx,Custom Tool被移除/无自动生成的实体等
在你的上下文课......
public class SqlServerContext : ObjectContext, IUnitOfWork
{
public SqlServerContext(EntityConnection entityConnection,
ILoggingService loggingService)
: base(entityConnection) { .... }
public ObjectResult<Location> FindLocationsWithinABoundingBox(decimal upperLeftLongitude,
decimal upperLeftLatitude,
decimal lowerRightLongitude,
decimal lowerRightLatitude)
{
return base.ExecuteFunction<Location>("FindLocationsWithinABoundingBox",
new ObjectParameter("UpperLeftLatitude", upperLeftLongitude),
new ObjectParameter("UpperLeftLongitude", upperLeftLatitude),
new ObjectParameter("LowerRightLongitude", lowerRightLongitude),
new ObjectParameter("LowerRightLatitude", lowerRightLatitude));
}
}
Run Code Online (Sandbox Code Playgroud)
dat就是它.
不确定我的POCO方式是否是最好的做事方式,但它......好..工作:)
而这是一个相关的StackOverflow问题,我问有关在服务/ IQueryable的方式使用该存储过程... :)
| 归档时间: |
|
| 查看次数: |
3526 次 |
| 最近记录: |