-
Notifications
You must be signed in to change notification settings - Fork 49
Expand file tree
/
Copy pathBaseAuditPersistence.cs
More file actions
30 lines (28 loc) · 1.19 KB
/
BaseAuditPersistence.cs
File metadata and controls
30 lines (28 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
namespace ServiceControl.Audit.Persistence.Sql.Core.Abstractions;
using Azure.Storage.Blobs;
using Implementation;
using Implementation.UnitOfWork;
using Infrastructure;
using Microsoft.Extensions.DependencyInjection;
using ServiceControl.Audit.Auditing.BodyStorage;
using ServiceControl.Audit.Persistence.UnitOfWork;
public abstract class BaseAuditPersistence
{
protected static void RegisterDataStores(IServiceCollection services, AuditSqlPersisterSettings settings)
{
services.AddSingleton<MinimumRequiredStorageState>();
if (!string.IsNullOrEmpty(settings.MessageBodyStoragePath))
{
services.AddSingleton<IBodyStoragePersistence, FileSystemBodyStoragePersistence>();
}
else
{
services.AddSingleton<IBodyStoragePersistence, AzureBlobBodyStoragePersistence>();
}
services.AddScoped<IBodyStorage, BodyStorageFetcher>();
services.AddSingleton<IAuditDataStore, EFAuditDataStore>();
services.AddSingleton<IFailedAuditStorage, EFFailedAuditStorage>();
services.AddSingleton<IAuditIngestionUnitOfWorkFactory, AuditIngestionUnitOfWorkFactory>();
services.AddSingleton(TimeProvider.System);
}
}