I have a custom setter for an object property that I want to add some custom logging to, such that I can look at the logs and see when that value is changed. However, it seems that whenever NHibernate reads that value from the Database and populates the object, the logging gets triggered. Is there a way to programatically determine that the change is happening because NHibernate is populating the object?
public virtual string URL
{
get
{
return pURL;
}
set
{
if (!value.ToLower().Contains("https://"))
{
specialLog.Warn($"Set a URL to {value} with no HTTPS. Callstack: {Environment.StackTrace}"); //This is triggered on NHibernate read always
}
pURL = value;
}
}