EFDesigner2022 icon indicating copy to clipboard operation
EFDesigner2022 copied to clipboard

Update nested Entities not working

Open MyKeySoftMK opened this issue 1 year ago • 2 comments

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

MyKeySoftMK avatar Jan 04 '24 17:01 MyKeySoftMK

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

msawczyn avatar Jan 16 '24 15:01 msawczyn

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.

MyKeySoftMK avatar Apr 06 '24 14:04 MyKeySoftMK