The standard way to combine objects in LlblGenPro

I start with entity A with primary key A1, it has child collections B and C, but they are empty because I did not pre-select them. Now I get a new occurrence A (A prime) with primary key A1 with populated child collections B and C.

What is a good way to get A and A prime to be the same object and get filled collections B and C?

+4
source share
1 answer

Once you have 2 separate objects in memory, and you have links to both of them, the only way to merge them is to change all the links to point to one of the objects, which may not be possible. However, in this case you can not use this class, you can use the SD.LLBLGen.Pro.ORMSupportClasses.Context class, which can be connected to the adapter and which acts as a cache level, and when objects are loaded, it returns the same object for a unique object, basically it does not allow duplicating entities in memory and always returns a link to an already loaded object.

+2
source

Source: https://habr.com/ru/post/1276579/


All Articles