We've found 2 problems in DO4 with Notifications for newly created Entities:

  • Some propertychanges are notified twice: [list:17wp0xat][*:17wp0xat]First time when the property changes
  • Second time is during ApplyChanges()

[/:m:17wp0xat] Id changes are not notified at all[/list:u:17wp0xat]

My Colleague Andres Rohr already reported the second problem in a Skype chat with Alex:

Hi Alex, a short question: In the disconnected state: If I am creating a new entity (which has an autoid as key) and save it I don't get a 'OnSetFieldValue' event for the Id. This would update the Id in our lists. Is this by design or a bug? I made a small proggy to test that and it's really this way. I see the 'OnSetFieldValue' for all the other properties but not the exchange of the Id.

Please find a test project in the Attachment to this Message

Regards Paul Sinnema Diartis AG

This thread was imported from our support forum. The original discussion may contain more detailed answer.

asked Jul 26 '10 at 09:49

Paul%20Sinnema's gravatar image

Paul Sinnema

One Answer:

The value of [Key] fields isn't directly assigned (note that there is even private setter) - we consider entity never exists without a key, so key is assigned during entity initialization. I.e. you simply can't see an entity w/o assigned key - @ any event you can handle, or protected method that can be overriden.

Actually, we fetch all the field values from internal row-like structure: Tuple. So during initialization, [Key] field values are assigned directly to Tuple fields. That's why event for [Key] is never raised.

I'm not fully sure if this must be fixed - we consider it's a natural behavior:

  • Entity appears with key

  • Key can never change. The only exception from this rule is key remapping that happens on completion of DisconnectedState.ApplyChanges method - here we don't set key fields directly as well, but sent "all properties are changed" via INotifyPropertyChanged interface on completion of this process).

**> First time when the property changes

Second time is during ApplyChanges()**

That's normal, since we replay the operations on "connected" entities.

You can distinguish between these two cases using Session.IsDisconnected or Session.DisconnectedState properties.

answered Jul 26 '10 at 12:37

Alex%20Yakunin's gravatar image

Alex Yakunin

Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
toggle preview

powered by OSQA