mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-20 13:33:34 -07:00
SignalR/Nancy/Owin/Mono
This commit is contained in:
parent
45b4972091
commit
87a5dc7869
40 changed files with 2375 additions and 76 deletions
|
@ -5,6 +5,8 @@ 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.Core.Tv;
|
||||
|
||||
|
||||
|
@ -34,14 +36,16 @@ namespace NzbDrone.Core.Datastore
|
|||
|
||||
public class BasicRepository<TModel> : IBasicRepository<TModel> where TModel : ModelBase, new()
|
||||
{
|
||||
private readonly IMessageAggregator _messageAggregator;
|
||||
|
||||
//TODO: add assertion to make sure model properly mapped
|
||||
|
||||
|
||||
private readonly IDataMapper _dataMapper;
|
||||
|
||||
public BasicRepository(IDatabase database)
|
||||
public BasicRepository(IDatabase database, IMessageAggregator messageAggregator)
|
||||
{
|
||||
_messageAggregator = messageAggregator;
|
||||
_dataMapper = database.DataMapper;
|
||||
}
|
||||
|
||||
|
@ -99,7 +103,9 @@ namespace NzbDrone.Core.Datastore
|
|||
throw new InvalidOperationException("Can't insert model with existing ID");
|
||||
}
|
||||
|
||||
var id = _dataMapper.Insert(model);
|
||||
_dataMapper.Insert(model);
|
||||
_messageAggregator.PublishEvent(new ModelEvent<TModel>(model, ModelEvent<TModel>.RepositoryAction.Created));
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue