2017-07-20 11:21:28 +02:00
|
|
|
|
using System;
|
2020-09-18 15:27:38 +02:00
|
|
|
|
using Microsoft.Extensions.Logging;
|
2021-02-09 10:22:42 +01:00
|
|
|
|
using Umbraco.Cms.Core.Events;
|
|
|
|
|
|
using Umbraco.Cms.Core.Persistence.Querying;
|
|
|
|
|
|
using Umbraco.Cms.Core.Services;
|
2015-07-23 20:04:40 +02:00
|
|
|
|
using Umbraco.Core.Events;
|
2016-11-30 19:23:20 +01:00
|
|
|
|
using Umbraco.Core.Persistence.Querying;
|
2017-12-12 15:04:13 +01:00
|
|
|
|
using Umbraco.Core.Scoping;
|
2015-01-19 18:37:48 +11:00
|
|
|
|
|
2017-12-28 09:18:09 +01:00
|
|
|
|
namespace Umbraco.Core.Services.Implement
|
2015-01-19 18:37:48 +11:00
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
2016-05-02 12:17:30 +02:00
|
|
|
|
/// Represents a service that works on top of repositories.
|
2015-01-19 18:37:48 +11:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
public abstract class RepositoryService : IService
|
|
|
|
|
|
{
|
2017-05-12 14:49:44 +02:00
|
|
|
|
protected IEventMessagesFactory EventMessagesFactory { get; }
|
2017-12-12 15:04:13 +01:00
|
|
|
|
protected IScopeProvider ScopeProvider { get; }
|
2020-09-18 15:27:38 +02:00
|
|
|
|
protected ILoggerFactory LoggerFactory { get; }
|
2016-12-01 08:29:11 +01:00
|
|
|
|
|
2020-09-18 15:27:38 +02:00
|
|
|
|
protected RepositoryService(IScopeProvider provider, ILoggerFactory loggerFactory, IEventMessagesFactory eventMessagesFactory)
|
2015-01-19 18:37:48 +11:00
|
|
|
|
{
|
2017-05-12 14:49:44 +02:00
|
|
|
|
EventMessagesFactory = eventMessagesFactory ?? throw new ArgumentNullException(nameof(eventMessagesFactory));
|
2017-12-12 15:04:13 +01:00
|
|
|
|
ScopeProvider = provider ?? throw new ArgumentNullException(nameof(provider));
|
2020-09-18 15:27:38 +02:00
|
|
|
|
LoggerFactory = loggerFactory ?? throw new ArgumentNullException(nameof(loggerFactory));
|
2015-01-19 18:37:48 +11:00
|
|
|
|
}
|
2016-11-30 19:23:20 +01:00
|
|
|
|
|
2017-12-12 15:04:13 +01:00
|
|
|
|
protected IQuery<T> Query<T>() => ScopeProvider.SqlContext.Query<T>();
|
2015-01-19 18:37:48 +11:00
|
|
|
|
}
|
2017-07-20 11:21:28 +02:00
|
|
|
|
}
|