简体   繁体   English

Oracle DB 记录只能使用 NetFrameworkCore for Oracle 访问一次

[英]Oracle DB record accessible once only using NetFrameworkCore for Oracle

I have a simple web solution (incomplete) using NetFrameworkCore for Oracle.我有一个使用 NetFrameworkCore for Oracle 的简单 Web 解决方案(不完整)。

See HomeController.CS & AspNetUser.CS -->参见 HomeController.CS 和 AspNetUser.CS -->

The issue is I have an AspNetUser record that was created in DB via Microsoft.AspNetCore.Identity.UserManager.问题是我有一个 AspNetUser 记录,它是通过 Microsoft.AspNetCore.Identity.UserManager 在 DB 中创建的。 This record is accessible by finding by ID, managed to retrieve record.此记录可通过 ID 查找来访问,并设法检索记录。

However, on stopping the solution and doing a re-run (without creating new AspNetUser), I cannot retrieve the record via the ID.但是,在停止解决方案并重新运行(不创建新的 AspNetUser)时,我无法通过 ID 检索记录。 Instead, a 500 error with invalid cast exception on Oracle.ManagedDataAccess.Client.OracleDataReader.GetDateTimeOffset() is thrown.相反,会引发 500 错误和 Oracle.ManagedDataAccess.Client.OracleDataReader.GetDateTimeOffset() 上的无效转换异常。 The issue may not be table column related as re-creating the table allows the record to be accessible again albeit once as well.该问题可能与表列无关,因为重新创建表允许再次访问记录,尽管也是一次。

What could be the issue then?那可能是什么问题? I apologize as I am new to Oracle and net core web.我很抱歉,因为我是 Oracle 和 net core web 的新手。 Below are the links to the error and web solution.以下是错误和网络解决方案的链接。

Error 500: https://1drv.ms/u/s!AjZf_PiMM9Arg6QLX9dfqkqu_Piepw错误 500: https : //1drv.ms/u/s!AjZf_PiMM9Arg6QLX9dfqkqu_Piepw

Solution: https://1drv.ms/u/s!AjZf_PiMM9Arg6QKrT3AuP3QTJaQYQ?e=5lLU97解决方案: https : //1drv.ms/u/s!AjZf_PiMM9Arg6QKrT3AuP3QTJaQYQ?e=5lLU97

I have managed to resolve the issue of InvalidCastException.我已经设法解决了 InvalidCastException 的问题。 The current Oracle table was created manually without using EntityFrameworkCore tool.当前的 Oracle 表是手动创建的,没有使用 EntityFrameworkCore 工具。

After dropping the table and re-creating using the commands "add-migration " & "update-database", the table is accessible on subsequent reads.删除表并使用命令“add-migration”和“update-database”重新创建后,可以在后续读取时访问该表。

The issue was with the column, LockoutEnd.问题出在列 LockoutEnd 上。

Changed from改自

"LockoutEnd" TIMESTAMP(7) NULL,

to

"LockoutEnd" TIMESTAMP (3) WITH TIME ZONE,

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

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