1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-16 11:37:58 +02:00

make model change events opt-in per repository

This commit is contained in:
kay.one 2013-05-21 22:31:29 -07:00
parent 28b47b415f
commit bd4856dad8
2 changed files with 9 additions and 7 deletions

View File

@ -194,10 +194,17 @@ public void SetFields(TModel model, params Expression<Func<TModel, object>>[] pr
}
protected virtual void PublishModelEvent(TModel model, RepositoryAction action)
private void PublishModelEvent(TModel model, RepositoryAction action)
{
_messageAggregator.PublishEvent(new ModelEvent<TModel>(model, action));
if (PublishModelEvents)
{
_messageAggregator.PublishEvent(new ModelEvent<TModel>(model, action));
}
}
protected virtual bool PublishModelEvents
{
get { return false; }
}
}
}

View File

@ -23,10 +23,5 @@ public void Trim()
var oldIds = Query.Where(c => c.Time < DateTime.Now.AddDays(-30).Date).Select(c => c.Id);
DeleteMany(oldIds);
}
protected override void PublishModelEvent(Log model, Datastore.Events.RepositoryAction action)
{
//Don't publish log added events.
}
}
}