1
votes

If my application has an Application Layer which exposes services that can be called by my Presentation Layer and these Application services return domain objects(not using DTOs) to the Presentation Layer, if a user changes the state of the domain object how do I then determine what has been changed by the user when it is passed back down to the Application Layer for updating??

So how does the Application Layer determine what changes that have been made to the domain object by the UI so that it can

  1. Begin a UnitOfWork
  2. Retrieve the domain object from repository
  3. Apply the changes to the domain object
  4. Commit the UnitOfWork
1
Yes, using Telerik OpenAccess.David

1 Answers

0
votes

Because you are using application services between presentation and "lower" layers, you probably use domain objects that are detached from the ORM session, you manipulate them in presentation, and return them back for persistence.

Real question is why do you need this. Usually dirty checking of entity is needed because user changes it in the UI, so you need to display messages like "Are you sure you want to leave this form" or something like that.

Either way, I suggest you look into databinding mechanisms on the UI frameworkyou are working on (WinForms / WPF ? ). You can have your entities implement something like INotifyPropertyChanged interface. You can have your presenter in UI listening for this change, and marking the current edited entity as dirty. You can have a base class for your entities containing IsDirty property. It all depends on where and what are you trying to do...