msawczyn / EFDesigner2022

Entity Framework visual design surface and code-first code generation for EF6, Core and beyond
MIT License
123 stars 21 forks source link

Update nested Entities not working #89

Open MyKeySoftMK opened 9 months ago

MyKeySoftMK commented 9 months ago

My code for update is following:

            Using _DbContext As New FxCorePrints(DbOptionBuilder.Options)

                _DbContext.Entry(serverPrintGroup).CurrentValues.SetValues(PrintGroupEntity)
                _DbContext.Update(serverPrintGroup)
                _DbContext.SaveChanges()

                NLOGLOGGER.Debug("PrintGroup is successfull modiefied in database")

            End Using

But when i have a new nested entity in PrintGroupEntity, then only the first level of properties will be modified - but not the added subentity

I have a Many:Many Join between Print and PrintGroup

msawczyn commented 8 months ago

Could you post a small project showing the problem? I'd be happy to look at it.

MyKeySoftMK commented 5 months ago

EFDesigner2022Tests.zip

Here is a MSTest-Project to show the problem. When I create a nested Entity the Parent and child will be create fine.

If i modify the Childs and will save it, then they didnt work

Can you give a hint for that how can i solve this on a common way. I hope it can be recursiv and automatic find all properties that be a collection.