EntityFramework-Plus icon indicating copy to clipboard operation
EntityFramework-Plus copied to clipboard

Batch update boolean type error with Oracle.EntityFrameworkCore: ORA-00932

Open NepPure opened this issue 4 years ago • 4 comments

Z.EntityFramework.Plus v5.1.33.0

Oracle.EntityFrameworkCore v5.21.1 with Oracle 19

ora-00932 inconsistent datatypes expected number got boolean

image

NepPure avatar May 08 '21 02:05 NepPure

Hello @NepPure ,

Do you think you could provide a runnable project sample for this issue? It will help my developer to get started to investigate it faster and make sure nothing is missing.

The last time someone reported us this error, a converter was missing on his side:

protected override void OnModelCreating(ModelBuilder builder)
{
                builder.Entity<EntitySimpleBool>().Property(x => x.IsDeleted).HasConversion(x => x ? 1 : 0, x => x == 1);
}

Providing a project sample is now REQUIRED. It happened too many times that something was missing to investigate and/or answer an issue.

Try to create a new project with only the minimal code (having too many non-related codes doesn’t help either).

You can send it to [email protected] if you need to keep the source private

Best Regards,

Jon


Performance Libraries context.BulkInsert(list, options => options.BatchSize = 1000); Entity Framework ExtensionsEntity Framework ClassicBulk OperationsDapper Plus

Runtime Evaluation Eval.Execute("x + y", new {x = 1, y = 2}); // return 3 C# Eval FunctionSQL Eval Function

JonathanMagnan avatar May 10 '21 01:05 JonathanMagnan

Thank you very much, I will try it as soon.

My project needs to support multiple relational database types at the same time. I think this conversion should only apply to Oracle. The configuration here seems unreasonable, or when using Oracle database, should I add a global conversion like this to the Bool type?

Should it be built into the Oracle of Z.EntityFramework.Plus?

There is no problem in updating the Bool type using EFCore's native method.

NepPure avatar May 10 '21 01:05 NepPure

We already tried to fix it by default through another request but meanwhile, the only solution is to add a conversion when you are using the Oracle provider. You probably know when your context uses Oracle so you can add a condition here.

As said, we already working to make it works by default. So it might get fixed in the upcoming week.

JonathanMagnan avatar May 10 '21 16:05 JonathanMagnan

protected override void OnModelCreating(ModelBuilder builder)
{
                builder.Entity<EntitySimpleBool>().Property(x => x.IsDeleted).HasConversion(x => x ? 1 : 0, x => x == 1);
}

When code first, add conversion like this will change the migration.

NepPure avatar May 11 '21 00:05 NepPure