mirror of
https://github.com/lidarr/Lidarr
synced 2024-12-26 01:27:00 +00:00
disable model events for log repository
This commit is contained in:
parent
99f269cd95
commit
6936f042f5
3 changed files with 18 additions and 8 deletions
|
@ -106,7 +106,7 @@ public TModel Insert(TModel model)
|
|||
}
|
||||
|
||||
DataMapper.Insert(model);
|
||||
_messageAggregator.PublishEvent(new ModelEvent<TModel>(model, ModelEvent<TModel>.RepositoryAction.Created));
|
||||
PublishModelEvent(model, RepositoryAction.Created);
|
||||
|
||||
return model;
|
||||
}
|
||||
|
@ -193,5 +193,11 @@ public void SetFields(TModel model, params Expression<Func<TModel, object>>[] pr
|
|||
.Execute();
|
||||
}
|
||||
|
||||
|
||||
protected virtual void PublishModelEvent(TModel model, RepositoryAction action)
|
||||
{
|
||||
_messageAggregator.PublishEvent(new ModelEvent<TModel>(model, action));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,14 +13,13 @@ public ModelEvent(T model, RepositoryAction action)
|
|||
Model = model;
|
||||
Action = action;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public enum RepositoryAction
|
||||
{
|
||||
Created = 1,
|
||||
Updated = 2,
|
||||
Deleted = 3
|
||||
}
|
||||
public enum RepositoryAction
|
||||
{
|
||||
Created = 1,
|
||||
Updated = 2,
|
||||
Deleted = 3
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -23,5 +23,10 @@ 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.
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue