Before I go any further, please check if all relations in the model are both ways. If not, make both ways/unhide the relations on one side so a relation is both ways
knez wrote:
Otis wrote:
Please elaborate on your setup a bit more, it's now too vague to get a clear picture.
Well, this obviously couldn't be avoided
.
The project I'm working on is "Register of Business Entities" (where Business Entities stand for Enterpreneurs (EnterpreneurEntity as subtype of BusinessEntityEntity)). All Enterpreneurs are registered through Submissions (RegistrationEntity as subtype of SubmissionEntity). Registration can be submitted (we call him the Presenter and it is reference to PersonEntity) by enterpreneur founder (EnterpreneurFounderEntity which has ). When Presenter is declared to be enterpreneur founder, and SubmissionEntity's reference to Presenter is set, automatically EnterpreneurFounderEntity with PersonEntity set should be added to Founders collection in EnterpreneurEntity object (using method AddFounder implemented in EnterpreneurEntity class).
I have a bit of a problem following this one, but let's say I do, and the first thing I see which is odd is 'AddFounder'.
I mean, if enterpreneurfounderentity.enterpreneur is set to the enterpreneur object, enterpreneurfounder is automatically added to enterpreneur.founders (the relation is both ways, similar to order.customer = mycustomer, which will make order to be added to mycustomer.orders)
So why AddFounder is required is not clear. Also, Founders collection, is that a generated collection or a collection created by yourself?
Previously mentioned PersonEntity object which is set as reference is fetched from database and it's IsDirtyand IsNew flags are set to false .
When SubmissionEntity object is saved recursively, everything is saved except EnterpreneurFounderEntity which references same PersonEntity as SubmissionEntity (even other EnterpreneurFounderEntity objects are saved properly).
Strange. how is the relation between person and enterpreneurfounder btw? I don't have that clear, so I don't know if EnterpreneurFounder is part of a collection in Person. If not, it won't be saved.
Perhaps a small database model would clear up the sky. You can mail it to us directly at support AT llblgen.com if you don't want it to be posted here in the open.
Since rule for adding EnterpreneurFounderEntity when setting Submission.Presenter can be performed only if Founders collection on EnterpreneurEntity object is empty, I tried changing SubmissionEntity's reference to Presenter. It kept the same EnterpreneurFounderEntity previously added, and in that situation EnterpreneurFounderEntity was saved.
After this I got lost, sorry.
What the thing is with recursive saves is: all entities have to be in the same graph as the entity you save recursively. This means, all entities have to be either referenced (1:1 or m:1 relations) or in an entity collection (not your own collection) inside an entity. So if I save myOrder recursively, it will save myCustomer, IF myOrder.Customer == myCustomer and it will also save any entity referenced from myCustomer, IF those entities are in llblgen pro collections or normal entity references based on relations. It doesn't matter if an entity isn't dirty, it will then be skipped and the graph is futher checked.
Is your entity graph setup that way?