MVC Entitiy Framework中的Oracle TTC错误

时间:2018-11-07 13:01:29

标签: asp.net-mvc oracle entity-framework odp.net

我想在Entity Framework中将Model First工作流程与Oracle SQL一起使用。 我可以使用“创建控制器”在数据库中创建新元素,但是当我要显示它时,却收到了不太详细的TTC错误消息:

TTC Error
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Exception: TTC Error

Source Error: 


Line 18:         public ActionResult Index()
Line 19:         {
Line 20:             return View(db.VALLALAT.ToList());
Line 21:         }
Line 22: 

Source File: ...\Controllers\VallalatController.cs    Line: 20 

每个模型我都遇到这个错误,在SQL表中有一个数据

[Exception: TTC Error]
   OracleInternal.TTC.TTCExecuteSql.ReceiveExecuteResponse(Accessor[]& defineAccessors, Accessor[] bindAccessors, Boolean bHasReturningParams, SQLMetaData& sqlMetaData, SqlStatementType statementType, Int64 noOfRowsFetchedLastTime, Int32 noOfRowsToFetch, Int32& noOfRowsFetched, Int64& queryId, Int32 longFetchSize, Int64 initialLOBFetchSize, Int64[] scnFromExecution, Boolean bAllInputBinds, Int32 arrayBindCount, DataUnmarshaller& dataUnmarshaller, MarshalBindParameterValueHelper& marshalBindParamsHelper, Int64[]& rowsAffectedByArrayBind, Boolean bDefineDone, Boolean& bMoreThanOneRowAffectedByDmlWithRetClause, List`1& implicitRSList, Boolean bLOBArrayFetchRequired) +3350
   OracleInternal.ServiceObjects.OracleDataReaderImpl.FetchMoreRows(Int32 noOfRowsToFetch, Boolean fillReader, Boolean returnPSTypes) +1511
   Oracle.ManagedDataAccess.Client.OracleDataReader.Read() +1365
   System.Data.Entity.Core.Common.Internal.Materialization.Shaper`1.StoreRead() +36

[EntityCommandExecutionException: An error occurred while reading from the store provider's data reader. See the inner exception for details.]
   System.Data.Entity.Core.Common.Internal.Materialization.Shaper`1.HandleReaderException(Exception e) +145
   System.Data.Entity.Core.Common.Internal.Materialization.Shaper`1.StoreRead() +49
   System.Data.Entity.Core.Common.Internal.Materialization.SimpleEnumerator.MoveNext() +41
   System.Data.Entity.Internal.LazyEnumerator`1.MoveNext() +112
   System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) +387
   System.Linq.Enumerable.ToList(IEnumerable`1 source) +58

我的环境:

  • Oracle数据库10g企业版10.2.0.2.0-64bi
  • 实体框架6.0
  • Oracle.ManagedDataAccess和EntityFramework 18.3

2 个答案:

答案 0 :(得分:0)

是的!我得到了答案。

Visual Studio为我生成了具有NCLOB属性的表。我将NCLOB更改为VARCHAR2,现在终于正确显示了列表。

更新: 不要忘记将ODP.NET驱动程序从18.3降级到12.2

答案 1 :(得分:0)

将ODP.NET驱动程序降级到12.2