mardi 8 décembre 2015

Good design to track changes in domain model

We have 2 separate existing applications that can only communicate through bus messaging system and database. Now we want to inform second app about any changes made to our domain model in the first app before or after db update: once we know there are real changes to be saved in a storage or have just been saved, we want to send specific message to a separate application. Message does not indicate what kind of changes are made.

Some considerations:

  • We would like to leave our domain model thin, I mean with no specific business logic inside, in the same time we do not want to add service references to our data layer (list of repository classes)
  • Ideally, we do not want to send message if there are no real changes are coming to database even if repository’s Update method was called.
  • It’s Ok if message is sent earlier than data are committed to db, even if they were finally rejected
  • Our domain model consists of dozens of objects with dozens of properties, so adding OnPropertyChanged to every property would take lots of time
  • We do not want to implement notification system on a storage level definitely
  • We’d like to build our application design the way no one developer can bypass this notification mechanism

What approaches would you recommend us to use in the case in terms of application design? Is it good practice for Data Layer to submit such notifications via bus system? How could we know data were actually changed: can we know it through NHiberate session or we got to track changes inside domain model?

We use latest versions of c#, NHibernate, NServiceBus

Aucun commentaire:

Enregistrer un commentaire