30 lines
867 B
C#
30 lines
867 B
C#
using Microsoft.Extensions.Logging;
|
|
|
|
using DomainResults.Common;
|
|
|
|
using MongoDB.Bson.Serialization;
|
|
using MongoDB.Driver;
|
|
|
|
using DataProviders.Abstractions;
|
|
using Core.DomainObjects.Documents;
|
|
|
|
namespace DataProviders.Collections {
|
|
|
|
public interface IContentDataProvider {
|
|
(List<Content>?, IDomainResult) Get(Guid siteId);
|
|
}
|
|
|
|
public class ContentDataProvider : CollectionDataProviderBase<Content>, IContentDataProvider {
|
|
|
|
private const string _collectionName = "content";
|
|
public ContentDataProvider(
|
|
ILogger<CollectionDataProviderBase<Content>> logger,
|
|
IMongoClient client,
|
|
IIdGenerator idGenerator,
|
|
ISessionService sessionService) : base(logger, client, idGenerator, sessionService) {
|
|
}
|
|
|
|
public (List<Content>?, IDomainResult) Get(Guid siteId) => GetWithPredicate(x => x.SiteId == siteId, _collectionName);
|
|
}
|
|
}
|