简体   繁体   English

设置EntityFramework 6和WCF数据服务5.6

[英]Setting up EntityFramework 6 and WCF Data Services 5.6

I'm trying to setup a project for Entityframwork 6 and WCF Data Services 5.6. 我正在尝试为Entityframwork 6和WCF Data Services 5.6设置项目。 I went through this page 我浏览了这个页面

I installed NuGet package By: 我安装了NuGet包用:

Install-Package Microsoft.OData.EntityFrameworkProvider -Pre 安装包Microsoft.OData.EntityFrameworkProvider -Pre

After That I tried to ADO.Net Entity Data Model using Wizard. 之后,我尝试使用向导ADO.Net实体数据模型。 It doesn't allow me to Go futher. 它不允许我进一步前进。 Error is like this 错误是这样的

Your Project references the latest version of EF; 您的项目引用了最新版本的EF; However and EF database provider comapatible with this version could not be found for your data connection. 但是,无法找到与此版本兼容的EF数据库提供程序用于您的数据连接。 Exit this wizard, install ta compatible provider, and rebuild your project before performing this action. 退出此向导,安装ta兼容的提供程序,然后在执行此操作之前重建项目。 and a link : http://msdn.microsoft.com/en-us/data/jj730568 和链接: http//msdn.microsoft.com/en-us/data/jj730568

My database is Oracle 11g and I'm using DevArt whose version is Oracle pro 8.0.146.0 我的数据库是Oracle 11g,我使用的是DevArt,其版本是Oracle pro 8.0.146.0

I thought it is some issue with DotConnect I checked with vendor they gave me this link 我认为这是DotConnect的一些问题,我与供应商核对过,他们给了我这个链接

I followed this too. 我也跟着这个。 But no success. 但没有成功。

When I try adding DevArt Data Model *edml it gives me Ef 6 too. 当我尝试添加DevArt Data Model * edml时,它也给了我Ef 6。 so when Create this edml and try a WCF Data Service give me The exception message is: 所以当创建这个edml并尝试WCF数据服务给我时,异常消息是:

The property 'EntityState' on type 'Models.USER' is not a valid property. 类型为“Models.USER”的属性“EntityState”不是有效属性。 Make sure that the type of the property is a public type and a supported primitive type or a entity type with a valid key or a complex type.'. 确保属性的类型是公共类型和受支持的基元类型或具有有效键或复杂类型的实体类型。 See server logs for more details. 请参阅服务器日志以获取更多详 The exception stack trace is: at System.Data.Services.Providers.ReflectionServiceProvider.BuildTypeProperties 异常堆栈跟踪是:at System.Data.Services.Providers.ReflectionServiceProvider.BuildTypeProperties

How can I set these up together? 我怎样才能将它们组合在一起?

Entityframework 6 , WCF Data Service 5.6 , DevArt oracle Connector Entityframework 6,WCF数据服务5.6,DevArt oracle连接器

Now Let me Ans for my questions itself. 现在让我回答我自己的问题。

  1. Entityframework 6 & WCF Data Serice was not working from Day 1. Why complex dependencies of EF 6 & Data Services 5.6. Entityframework 6和WCF Data Serice从第1天开始无效。为什么EF 6和Data Services 5.6的复杂依赖关系。
  2. DevArt Entity Wizard Create the Entities Data model with EntityObject which I don't why still why doesn't work with DataService. DevArt实体向导使用EntityObject创建实体数据模型,我不知道为什么仍然无法使用DataService。

So I followed Below mentioned Links like Final words http://blogs.msdn.com/b/odatateam/archive/2013/10/02/using-wcf-data-services-5-6-0-with-entity-framework-6.aspx?Redirected=true 所以我按照下面提到的链接,如最后的话http://blogs.msdn.com/b/odatateam/archive/2013/10/02/using-wcf-data-services-5-6-0-with-entity-framework -6.aspx?重定向=真

  1. created a fresh Blank MVC Project for DataService 5.6 为DataService 5.6创建了一个新的Blank MVC项目
  2. Install EF 6 with NuGet Package manager. 使用NuGet包管理器安装EF 6。
  3. installed Install-Package Microsoft.OData.EntityFrameworkProvider -Version 1.0.0-alpha2 安装Install-Package Microsoft.OData.EntityFrameworkProvider -Version 1.0.0-alpha2
  4. Create DataModel with DevArt EntityWizad for EF 6 choose DbContext Template (Don't why it still write the code with Both ObjectContext , DbContext 使用DevArt EntityWizad为EF 6创建DataModel选择DbContext模板(不要为什么它仍然使用ObjectContext,DbContext编写代码
  5. Remove Manually ObjectContext Auto Generated Code. 删除手动ObjectContext自动生成的代码。
  6. Add WCF data Service 5.6 For wizard 添加WCF数据服务5.6对于向导
  7. Change DataService to EntityFrameworkDataService 将DataService更改为EntityFrameworkDataService
  8. Register Entity Provider http://blog.devart.com/entity-framework-6-support-for-oracle-mysql-postgresql-sqlite-and-salesforce.html 注册实体提供商http://blog.devart.com/entity-framework-6-support-for-oracle-mysql-postgresql-sqlite-and-salesforce.html

    believe me complex dependecy of dll is the hurdle to cross. 相信我复杂的dll依赖是跨越的障碍。 For more you please read below threads. 有关更多信息,请阅读以下主题。 (Oopps.. I've not Reputation here so I can't post more links. Sorry) (Oopps ..我在这里没有声望,所以我无法发布更多链接。抱歉)

... "Your project references the latest version of Entity Framework; however, an Entity Framework database provider compatible with this version could not be found for your data connection. Exit this wizard, install a compatible driver, and rebuild your project before performing this action"... ...“您的项目引用了最新版本的Entity Framework;但是,找不到与此版本兼容的Entity Framework数据库提供程序用于您的数据连接。退出此向导,安装兼容的驱动程序,并在执行此项目之前重建项目行动”...

When working with EDM Designer you should add the registration of EF-provider to *.config before adding a new ADO.NET Entity Data Model to the project. 使用EDM Designer时,您应该在向项目添加新的ADO.NET实体数据模型之前将EF-provider的注册添加到* .config。 The sample for dotConnect for Oracle is available here: http://blog.devart.com/entity-framework-6-support-for-oracle-mysql-postgresql-sqlite-and-salesforce.html 有关dotConnect for Oracle的示例,请访问: http//blog.devart.com/entity-framework-6-support-for-oracle-mysql-postgresql-sqlite-and-salesforce.html

Entity Developer adds this registration of EF-provider to *.config automatically. Entity Developer会自动将此EF-provider注册添加到* .config。 We recommend you to use Entity Developer (Devart Entity Model, *.edml) instead of EDM Designer (ADO.NET Entity Data Model, *.edmx) because it is adjusted for working with Oracle and has an advanced functionality: http://www.devart.com/entitydeveloper/ed-vs-edm.html . 我们建议您使用Entity Developer(Devart实体模型,* .edml)而不是EDM Designer(ADO.NET实体数据模型,* .edmx),因为它已经过调整以便与Oracle一起使用并具有高级功能: http:// www.devart.com/entitydeveloper/ed-vs-edm.html

...The exception message is 'The property 'EntityState' on type 'Models.USER' is not a valid property. ...异常消息是'Models.USER'类型的属性'EntityState'不是有效属性。 Make sure that the type of the property is a public type and a supported primitive type or a entity type with a valid key or a complex type.'... 确保属性的类型是公共类型和受支持的基元类型或具有有效键或复杂类型的实体类型。

Please send us (support at devart*com) a small test project, with which the error could be reproduced, so that we are able to investigate it in more details and find a solution for you. 请发送给我们(devart * com的支持)一个小测试项目,可以重现错误,以便我们能够更详细地调查它并为您找到解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM