question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ISoftDelete with EF Core for Oracle, ORA-00972: identifier is too long Error

See original GitHub issue
  • Your Abp package version. 3.7

  • Your base framework: .Net Framework or .Net Core. Net Core 2.1

  • Exception message and stack trace if available. Oracle has a 30 character restriction for all object names.

ISoftDelete translate to “ef_filter__IsSoftDeleteFilterEnabled_0”(length > 30) in DbCommand.

ERROR 2019-01-09 10:33:52,245 [1    ] Default                                  - Failed executing DbCommand (290ms) [Parameters=[:ef_filter__IsSoftDeleteFilterEnabled_0='?' (DbType = Int16)], CommandType='Text', CommandTimeout='0']
SELECT COUNT(*)
FROM "ssrptmplmst" "e"
WHERE ("e"."delete_flag" = 0) OR ("e"."delete_flag" <> :ef_filter__IsSoftDeleteFilterEnabled_0)
Oracle.ManagedDataAccess.Client.OracleException (0x80004005): ORA-00972: 标识符过长
   at OracleInternal.ServiceObjects.OracleConnectionImpl.VerifyExecution(Int32& cursorId, Boolean bThrowArrayBindRelatedErrors, SqlStatementType sqlStatementType, Int32 arrayBindCount, OracleException& exceptionForArrayBindDML, Boolean& hasMoreRowsInDB, Boolean bFirstIterationDone)
   at OracleInternal.ServiceObjects.OracleCommandImpl.ExecuteReader(String commandText, OracleParameterCollection paramColl, CommandType commandType, OracleConnectionImpl connectionImpl, OracleDataReaderImpl& rdrImpl, Int32 longFetchSize, Int64 clientInitialLOBFS, OracleDependencyImpl orclDependencyImpl, Int64[] scnForExecution, Int64[]& scnFromExecution, OracleParameterCollection& bindByPositionParamColl, Boolean& bBindParamPresent, Int64& internalInitialLOBFS, OracleException& exceptionForArrayBindDML, OracleConnection connection, OracleLogicalTransaction& oracleLogicalTransaction, IEnumerable`1 adrianParsedStmt, Boolean isDescribeOnly, Boolean isFromEF)
   at Oracle.ManagedDataAccess.Client.OracleCommand.ExecuteReader(Boolean requery, Boolean fillRequest, CommandBehavior behavior)
   at Oracle.ManagedDataAccess.Client.OracleCommand.ExecuteDbDataReader(CommandBehavior behavior)
   at Oracle.EntityFrameworkCore.Storage.Internal.OracleRelationalCommandBuilderFactory.OracleRelationalCommandBuilder.OracleRelationalCommand.Execute(IRelationalConnection connection, DbCommandMethod executeMethod, IReadOnlyDictionary`2 parameterValues)

Override CreateFilterExpression(AbpDbContext)

Expression<Func<TEntity, bool>> softDeleteFilter = e => !((ISoftDelete)e).IsDeleted || ((ISoftDelete)e).IsDeleted != IsSoftDeleteFilterEnabled;

modified to

var SDFE = IsSoftDeleteFilterEnabled;
Expression<Func<TEntity, bool>> softDeleteFilter = e => !((ISoftDelete)e).IsDeleted || ((ISoftDelete)e).IsDeleted != SDFE;

can avoid this error, but I don’t think it’s a good practice. IMayHaveTenant and IMustHaveTenant may also have the same problem.

  • Steps needed to reproduce the problem. Use ISoftDelete feature for any entity with oracle database. The EF Core for Oracle is in private test, you can email dotnet_us@oracle.com for the package.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (9 by maintainers)

github_iconTop GitHub Comments

3reactions
acjhcommented, Jan 18, 2019
protected virtual bool SDFE => CurrentUnitOfWorkProvider?.Current?.IsFilterEnabled(AbpDataFilters.SoftDelete) == true;

This should be sufficient:

protected virtual bool SDFE => IsSoftDeleteFilterEnabled;

From https://github.com/aspnet/EntityFrameworkCore/pull/8283, Oracle should set this:

public override int MaxTableAliasLength => 30;
3reactions
malimingcommented, Jan 18, 2019

@NepPure @ismcagdas

I think shortening the parameter name in Abp is not a good solution.

@NepPure There is a problem with your previous solution. see https://github.com/aspnetboilerplate/aspnetboilerplate/pull/4195#issuecomment-455412984 You can customize the short parameters by referring to the Abp code, and then override the CreateFilterExpression method to resolve them with short parameters.

https://github.com/aspnetboilerplate/aspnetboilerplate/blob/dev/src/Abp.EntityFrameworkCore/EntityFrameworkCore/AbpDbContext.cs#L78

But in the end it should be solved by the EF Core or ORACLE database provider.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ORA-00972: identifier is too long error with EF Core 2.2 ...
Hi I found the solution for it at the oracle site and it is as below : // Limit 30 char length as...
Read more >
Entity Framework ORA-00972: identifier is too long
I'm having allot of trouble figuring out what I can do to make a ORA-00972 go away. I have a listView with sorting/paging...
Read more >
ORA-00972: identifier is too long - My Oracle Support
After 19c Database Upgrade Concurrent Programs Fail With Error: ORA-00972: identifier is too long (Doc ID 2797871.1).
Read more >
ORA-00972: identifier is too long
ORA-00972 occurs when you have tried to reference a table, cluster, view, index, synonym, tablespace, or username with a value that is longer...
Read more >
Identifier is too long - Oracle 12.2 Compatible to 12.1
I'm getting an exception ORA-00972: identifier is too long on Oracle 12.2 BUT compatible to 12.1. DevArt 9.6.540.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found