Closed viniciusverasdossantos closed 1 year ago
Hello @viniciusverasdossantos
Thank you for all the information. We pretty much know exactly where the code has an issue, but unfortunately, your code looks a little bit too much complex to try to reproduce on our side (we might surely miss something if we do).
Do you think you could create a runnable project with the issue? It doesn’t need to be your project, just a new solution with the minimum code to reproduce the issue. You can send it in private here: info@zzzprojects.com
Best Regards,
Jon
I discovered that the problem is in the Owned DadosComercioEletronico property
If I just ignore it in the mapping...everything works. I tried to reproduce in the seaprado project but it has many dependencies and the problem did not occur.
It works by adding: builder.Ignore(p => p.DadosComercioEletronico); rather than: builder.OwnsOne(p => p.DadosComercioEletronico); builder.Navigation(p => p.DadosComercioEletronico).IsRequired();
Could you help?
Hello @viniciusverasdossantos ,
Unfortunately, we do not have the error in your project.
We had to delete the existing row prior to insert
using (var context = new ProductContext())
{
context.Products.DeleteFromQuery();
}
But besides that, the code seems to work perfectly without an error.
Could you double-check the code you provided to make sure it contains the error?
Best Regards,
Jon
Hi,
I have similar issue (I think for same reason), in my case it happens only when an entity and it childs list has complex types props and we try to enter a value on a non nullable field which the library detects at null, on this example, it fails if we try to save a 0 enum value but not on any other value on same enumerator (it fails also if the complex type has a GUID and we try to sabe a GUID empty). Here you have the example https://dotnetfiddle.net/QfHYDT, as you can see removing the line when we try to save first enum value it works (also if we mark the enum as nullable). Do you also think it could be same?
Hello,
we have the exact same error.
I think it happens when the owned/complex type is used more than once.
In the sample of @LuisNebreda it´s the type Props
.
The reason is that EF Core returns null
when you call DbContext.Model.FindEntityType(typeof(Props))
what you do here.
I think you're right, and it has an error retrieving it type. Because in my case it happens only if we try to save a record with a value than "looks" to be null (like 0 on enum or guid empty) on that object appearance twice
if not it works So, I thought, some way, is not evaluating correctly if it's null or not, surely, as you said, because is not retrieving it type properly
Hello @LuisNebreda ,
Thank you for the Fiddle,
My developer confirms that is indeed a bug, he is currently looking at it.
Best Regards,
Jon
Do you have an update planned? Stopped my tests
Hello @viniciusverasdossantos ,
Sorry for the delay, I forgot to notify you that we released the fix for this issue on Tuesday.
Could you try the latest version and let us know if everything work now?
Best Regards,
Jon
Worked, thank you! I'm having a problem with UpdateFromQuery now. MAs in the previous version was already. I will open issue.
Working for me too, thanks a lot
Description
Describe the issue or proposed feature. I'm migrating my project from EF6 to EF Core 7 and I'm having a problem with a bulk insert in a specific entity
Code:
EntityTypeConfiguration:
Exception
Value cannot be null. (Parameter 'key')
Log:
Exception message:
Further technical details