fluxera / Fluxera.Repository

A generic repository implementation.
MIT License
16 stars 3 forks source link

Entity Framework owned entities not saving #105

Closed roly445 closed 8 months ago

roly445 commented 1 year ago

Hi, I have just started looking into using this framework to accelerate my development around DDD.

I am currently using EF core and owned entities and I'm having issues with the persistence on these types.

I have used Rider to debug into the assembly as it's running and found that if I force the skipping the method PrepareItem in EntityFrameworkCoreRepository it works as expected.

Do you have any guidance on this?

Many thanks

mgernand commented 1 year ago

Hi, thanks for bringing this to our attention. Can you post your repository and EF Core configuration? Or do you have an example app that we can look at?

roly445 commented 1 year ago

I have something; just let me get it in a reasonable state and I'll send you a link to the repository.

roly445 commented 1 year ago

I have just tidied up the solution and uploaded it here https://github.com/roly445/spamma. Hopefully it makes sense.

roly445 commented 10 months ago

Would you accept a PR for this?

mgernand commented 10 months ago

Would you accept a PR for this?

Yes, absolutely. Please include tests that reproduce the problem.

roly445 commented 10 months ago

Thanks, I will do. Just so I know, what was the rationale behind modifying the entity's state?

I only ask because if I remove the calls to PrepareItem from the AddAsync and AddRangeAsync methods all the unit tests still pass

mgernand commented 10 months ago

Just so I know, what was the rationale behind modifying the entity's state?

To be honest, I don't know anymore why I did that. 🙈