3

私は複数のデータベースを対象とするエンティティフレームワークに基づいて、データのアクセスにエンティティフレームワークを使用しています。エンティティフレームワーク左外部結合とグループにスローされます。ORA-00907を:欠落している右括弧

私たちはEntity Frameworkで2年間働いているチームであり、生成されたコードはSQL Server 2008で完全に機能します。データベースをOracle 11 Express r2g2に移行した後、同じコードをテストします。このコールスタックを示す選択スロー例外への参加やグループ外左そのメイク:

System.Data.EntityCommandExecutionException was unhandled by user code 
Message=An error occurred while executing the command definition. See the inner exception for details. 
Source=System.Data.Entity 
StackTrace: 
at System.Data.EntityClient.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior) 
at System.Data.Objects.Internal.ObjectQueryExecutionPlan.Execute[TResultType](ObjectContext context, ObjectParameterCollection parameterValues) 
at System.Data.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption) 
at System.Data.Objects.ObjectQuery`1.System.Collections.Generic.IEnumerable<T>.GetEnumerator() 
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) 
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) 
at Futura.BusinessLogic.Services.DemandeHospitalisationServices.DemandeHospitalisationService.GetMedecinList() in C:\Work\FuturaSmartDesign\Futura.BusinessLogic\Services\DemandeHospitalisationServices\DemandeHospitalisationService.cs:line 87 
at GetMedecinList(DomainService , Object[]) 
at System.ServiceModel.DomainServices.Server.ReflectionDomainServiceDescriptionProvider.ReflectionDomainOperationEntry.Invoke(DomainService domainService, Object[] parameters) 
at System.ServiceModel.DomainServices.Server.DomainOperationEntry.Invoke(DomainService domainService, Object[] parameters, Int32& totalCount) 
at System.ServiceModel.DomainServices.Server.DomainService.Query(QueryDescription queryDescription, IEnumerable`1& validationErrors, Int32& totalCount) 
InnerException: Oracle.DataAccess.Client.OracleException 
Message=ORA-00907: missing right parenthesis 
Source=Oracle Data Provider for .NET 
ErrorCode=-2147467259 
DataSource=Calys 
Number=907 
Procedure="" 
StackTrace: 
at Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, String procedure, Boolean bCheck, Exception innerException) 
at Oracle.DataAccess.Client.OracleException.HandleError(Int32 errCode, OracleConnection conn, String procedure, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, Boolean bCheck, Exception innerException) 
at Oracle.DataAccess.Client.OracleCommand.ExecuteReader(Boolean requery, Boolean fillRequest, CommandBehavior behavior) 
at Oracle.DataAccess.Client.OracleCommand.ExecuteDbDataReader(CommandBehavior behavior) 
at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior) 
at System.Data.EntityClient.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior) 
InnerException: 
Message=Oracle 11.2.0.2.0 ne prend pas en charge APPLY 
InnerException: 

すべてのヘルプは、事前に おかげで理解されるであろう。

+1

間違い –

+0

+1を生成SQLを表示してくださいエラー – Regfor

+0

を生成呼び出し、要求またはSQLステートメントのにそれを提示してくださいSQL文ではなく、linqクエリでした。それはSQL Serverと完全に連携しました –

答えて

3

これはエンティティフレームワークによって生成されたコードによるものであった:CROSS/OUTERが適用されます。 Oracleはサポートしていませんでした。ここConnectの報告された 、https://connect.microsoft.com/VisualStudio/feedback/details/739458/linq-query-whene-used-with-oracle-11-g2-getting-ora-00907-missing-right-parenthesis

任意の回避策 は、私は私のEFクエリがあまりにも多く持っていたときEF 5およびOracle 11gと、このエラーが発生しましたMS接続プラットフォーム

2

に理解されるであろうが、「インクルード」。私の場合は、7 "インクルード"でこのエラーが発生します。

 var myEntity = __DbContext.Get<MyEntity>() 
      .Include("Property1") 
      .Include("Property2") 
      .Include("Property3") 
      .Include("Property4") 
      .Include("RelatedEntities.Property1") 
      .Include("RelatedEntities.Property2") 
      .Include("RelatedEntities.Property3") 
      .First(c => c.Id == id); 

私は私のデータをフェッチするために2つのクエリを作ってそれを変更:

 var myEntity = __DbContext.Get<MyEntity>() 
      .Include("Property1") 
      .Include("Property2") 
      .Include("Property3") 
      .Include("Property4") 
      .First(c => c.Id == id); 

     myEntity.RelatedEntities = __DbContext.Get<RelatedEntity>() 
      .Include("Property1") 
      .Include("Property2") 
      .Include("Property3") 
      .Where(re => re.MyEntityId == myEntity.Id) 
      .ToList(); 
関連する問題