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