We are using LLblgen self servicing to create all our entities. Our main entity is known as MatterEntity it is obtained using the SD.LLBLGen.Pro.ORMSupportClasses.Context. This works great for most of our scenarios. Unfortunately, the scenario we are having problems with is when we build a screen to edit a collection class that hangs off MatterEntity such as a AdditionalInformationCollection. We can add/remove items and edit.
We need to give the user a cancel option which will cancel the changes. We tried this by calling the llblgen generated methods on MatterEntity like
GetMultiAdditionalInformation(bool forceFetch)
we set the forcefetch to true and it got rid of the changes and reloaded the items, it worked great for entities that were aded and removed, unfortunately because we were using the Context class it checked if items existed in the context when it ran. This had the effect of keeping the original edits as the entities existed within the context.
After looking into the Context class we found a property called:
SetExistingEntityFieldsInGet
We assumed this would sort out the problem and force the reload of all entities from the database without checking the context. It didn't work and when we browsed the source code found that it only gets applied when the entity is NOT dirty.
Can anyone offer any suggestions on the best way to achieve this. We were thinking about creating our own method in a MatterEntity partial class that called GetMultiAdditionalInformation(bool forceFetch) and then looped through each entity and called refetch if the entity was dirty. Although this would not be performant for a user whom has made changes to a lot of entities in that collection and then clicks cancel.