Skip to content

Commit 53ee20b

Browse files
committed
chore: added changes from review
1 parent b6d7a92 commit 53ee20b

File tree

5 files changed

+6
-14
lines changed

5 files changed

+6
-14
lines changed

src/Serilog.Ui.Core/Extensions/RelationalDbOptionsExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
public static class RelationalDbOptionsExtensions
44
{
55
public static string ToDataProviderName(this RelationalDbOptions options, string providerName)
6-
=> string.Join(".", "MSSQL", options.Schema, options.TableName);
6+
=> string.Join(".", providerName, options.Schema, options.TableName);
77
}
88
}

src/Serilog.Ui.Core/IDataProvider.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,3 @@ public interface IDataProvider
3434
string Name { get; }
3535
}
3636
}
37-
namespace Serilog.Ui.Core.Services
38-
{
39-
}

src/Serilog.Ui.ElasticSearchProvider/ElasticSearchDbDataProvider.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace Serilog.Ui.ElasticSearchProvider
1010
{
1111
public class ElasticSearchDbDataProvider : IDataProvider
1212
{
13-
public string Name { get; set; }
13+
public string Name => string.Join(".", "ES", _options.IndexName);
1414

1515
private readonly IElasticClient _client;
1616
private readonly ElasticSearchDbOptions _options;
@@ -19,7 +19,6 @@ public ElasticSearchDbDataProvider(IElasticClient client, ElasticSearchDbOptions
1919
{
2020
_client = client ?? throw new ArgumentNullException(nameof(client));
2121
_options = options ?? throw new ArgumentNullException(nameof(options));
22-
Name = string.Join(".", "ES", _options.IndexName);
2322
}
2423

2524
public Task<(IEnumerable<LogModel>, int)> FetchDataAsync(

src/Serilog.Ui.MongoDbProvider/MongoDbDataProvider.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@ namespace Serilog.Ui.MongoDbProvider
1010
public class MongoDbDataProvider : IDataProvider
1111
{
1212

13-
public string Name { get; }
13+
public string Name => string.Join(".", "MongoDb", _options.DatabaseName, _options.CollectionName);
1414

1515
private readonly IMongoCollection<MongoDbLogModel> _collection;
16+
private readonly MongoDbOptions _options;
1617

1718
public MongoDbDataProvider(IMongoClient client, MongoDbOptions options)
1819
{
20+
_options = options;
1921
if (client is null) throw new ArgumentNullException(nameof(client));
2022
if (options is null) throw new ArgumentNullException(nameof(options));
2123

2224
_collection = client.GetDatabase(options.DatabaseName)
2325
.GetCollection<MongoDbLogModel>(options.CollectionName);
24-
25-
Name = string.Join(".", "MongoDb", options.DatabaseName, options.CollectionName);
2626
}
2727

2828
public async Task<(IEnumerable<LogModel>, int)> FetchDataAsync(

src/Serilog.Ui.Web/Extensions/ServiceCollectionExtensions.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,7 @@ public static IServiceCollection AddSerilogUi(this IServiceCollection services,
3333
var builder = new SerilogUiOptionsBuilder(services);
3434
optionsBuilder.Invoke(builder);
3535

36-
services.TryAddScoped(typeof(AggregateDataProvider), p =>
37-
{
38-
var providers = p.GetServices<IDataProvider>();
39-
return new AggregateDataProvider(providers);
40-
});
36+
services.TryAddScoped(typeof(AggregateDataProvider));
4137

4238
return services;
4339
}

0 commit comments

Comments
 (0)