signalr cleanup

This commit is contained in:
kay.one 2013-09-10 23:33:47 -07:00 committed by Keivan Beigi
parent feda4a9b67
commit 25e2c98c45
219 changed files with 2035 additions and 1495 deletions

View file

@ -4,9 +4,9 @@ using System.Linq;
using System.Linq.Expressions;
using Marr.Data;
using Marr.Data.QGen;
using NzbDrone.Common.Messaging;
using NzbDrone.Core.Datastore.Events;
using NzbDrone.Common;
using NzbDrone.Core.Messaging;
namespace NzbDrone.Core.Datastore
@ -115,7 +115,6 @@ namespace NzbDrone.Core.Datastore
}
DataMapper.Insert(model);
PublishModelEvent(model, RepositoryAction.Created);
return model;
}
@ -222,7 +221,22 @@ namespace NzbDrone.Core.Datastore
DataMapper.Delete<TModel>(c => c.Id > 0);
}
private void PublishModelEvent(TModel model, RepositoryAction action)
protected void ModelCreated(TModel model)
{
PublishModelEvent(model, ModelAction.Created);
}
protected void ModelUpdated(TModel model)
{
PublishModelEvent(model, ModelAction.Updated);
}
protected void ModelDeleted(TModel model)
{
PublishModelEvent(model, ModelAction.Deleted);
}
private void PublishModelEvent(TModel model, ModelAction action)
{
if (PublishModelEvents)
{
@ -230,16 +244,6 @@ namespace NzbDrone.Core.Datastore
}
}
protected virtual void OnModelChanged(IEnumerable<TModel> models)
{
}
protected virtual void OnModelDeleted(IEnumerable<TModel> models)
{
}
protected virtual bool PublishModelEvents
{
get { return false; }