64 lines
1.8 KiB
C#
64 lines
1.8 KiB
C#
using System;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.Extensions.Logging;
|
|
using xAiApi.Data.Interfaces;
|
|
using xAiApi.Data.Models;
|
|
using xCommons.Extensions;
|
|
using xDataService.Configuration;
|
|
using xDataService.Interfaces;
|
|
|
|
namespace xAiApi.Data.Seeder
|
|
{
|
|
public class XAiApiDbSeeder : IXDbSeeder
|
|
{
|
|
//
|
|
public IXDbSeederConfig Config { get; }
|
|
public readonly IXAiApiDbSeederConfig config;
|
|
private readonly ILogger<XAiApiDbSeeder> logger;
|
|
private readonly IXTestRepository testsRepository;
|
|
public XDataServiceConfiguration DataServiceConfiguration { get; }
|
|
|
|
//
|
|
public XAiApiDbSeeder(
|
|
ILogger<XAiApiDbSeeder> logger,
|
|
IXTestRepository testsRepository,
|
|
IXAiApiDbSeederConfig config = null,
|
|
XDataServiceConfiguration dataServiceConfiguration = null
|
|
)
|
|
{
|
|
Config = config;
|
|
this.config = config;
|
|
this.logger = logger;
|
|
this.testsRepository = testsRepository;
|
|
DataServiceConfiguration = dataServiceConfiguration;
|
|
}
|
|
|
|
public async Task Seed()
|
|
{
|
|
//
|
|
// TODO: Do any additional Seeding ...
|
|
try
|
|
{
|
|
//
|
|
// Check Configuration Exists ...
|
|
if (config.IsNull())
|
|
{
|
|
logger.LogInformation($"there is no Configured Objects to Seed ...");
|
|
}
|
|
else
|
|
{
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
logger.LogError($"Failed Seeding: {ex.Message} ...");
|
|
}
|
|
}
|
|
|
|
//
|
|
#region Private ...
|
|
private async Task SeedTest(XTestDescriptor dTests)
|
|
{ }
|
|
#endregion
|
|
}
|
|
} |