oData 作为实体框架的数据源
是否可以使用oData作为实体框架的数据源?我们正在研究我们的 Web 应用程序调用 wcf 方法的可能性,该方法将为实体框架 4.2 生成的实体返回 oData。我想知道这是否可能,如果可以的话我将如何去做。
任何建议将不胜感激!
Is it possible to use oData as a datasource for entity framework? We are looking at the possibility of our web app calling a wcf method that would return oData for our entites generated by entity framework 4.2. I'm wondering if this was possible and if so how I would go about doing it.
Any advice would be much appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您使用 OData(使用 WCF 数据服务),您将已经获得上下文和生成的实体。只需将服务引用添加到 OData 服务,它就会为您生成所有实体和客户端。
OData 不是 EF 的有效数据源。 EF是用于与数据库提供者通信的ORM。您正在寻找将 .NET 调用(和 LINQ 查询)转换为 OData 协议的提供程序 - 这就是 WCF 数据服务应该做的事情。
If you consume OData (with WCF Data Services) you will already get context and generated entities. Just add service reference to OData service and it should generate all entities and client for you.
OData is not valid data source for EF. EF is ORM for communication with database provider. You are looking for provider transforming .NET calls (and LINQ queries) into OData protocols - that is what WCF Data Services are supposed to do.