I am trying to get started in the "DDD with C #" world. I am using NHibernate as an ORM tool, trying to develop a PI (Persistence Notorance) model. However, in some of my entities (which are represented as POCOS), I have business rules in my properties settings. For example, I have a โUserโ object that has a flag indicating whether this user is blocked or not, when this flag is a true second field โBlock Dateโ, should be automatically filled with the current date. Everything seems very clear and simple, but the problem arises at the moment when I restore users who are already stored in the database, although blocked users will update their "Blocked dates" to the current date, according to this logic. Initially, I thought that the second flag is "isLoaded", which indicates that the object is hydrated by NHibernate, and then this logic will not start, however it did not seem to PI. Any suggestion on how to improve this?
source share