asp.net-mvc - MVC Entity Framework 中的 Oracle TTC 错误

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

我想将 Entity Framework 中的模型优先工作流与 Oracle SQL 结合使用。 我可以使用 Create Controller 在数据库中创建新元素,但是当我想显示它时,我收到了一条不太详细的 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
  • Entity Framework 6.0
  • Oracle.ManagedDataAccess 和 EntityFramework 18.3

最佳答案

耶!我得到了答案。

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

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

关于asp.net-mvc - MVC Entity Framework 中的 Oracle TTC 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53189985/

相关文章:

asp.net - 将css文件添加到cshtml文件?

asp.net-mvc - 当前上下文中不存在 MVC Razor 帮助程序

oracle - 防止 sqlplus 截断列名,而无需单独的列格式

entity-framework - Entity Framework 5 数据库命名空间

c# - 将 MyDbContext 合并到 Asp.net IdentityDbContext

javascript - 在没有模型的情况下在 MVC 3 中进行验证

c# - 无法动态调度 Html.ActionLink

database - 从不同的模式查询两个表

sql - Oracle 全局临时表 - 最大记录数?

c# - 如何在 Entity Framework 中重命名迁移表?