Implement data parsing service
This commit is contained in:
@ -3,12 +3,11 @@ using Hcs.WebApp.Data.Hcs;
|
||||
|
||||
namespace Hcs.WebApp.BackgroundServices.DataParsers
|
||||
{
|
||||
public abstract class DataParserBase(IClient client, IServiceScope scope, Operation operation) : IDataParser
|
||||
public abstract class DataParserBase(IServiceScope scope, Operation operation) : IDataParser
|
||||
{
|
||||
protected readonly IClient client = client;
|
||||
protected readonly IServiceScope scope = scope;
|
||||
protected readonly Operation operation = operation;
|
||||
|
||||
public abstract Task<bool> ParseAsync();
|
||||
public abstract Task ParseAsync();
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,11 +5,11 @@ namespace Hcs.WebApp.BackgroundServices.DataParsers
|
||||
{
|
||||
public class DataParserFactory
|
||||
{
|
||||
public IDataParser CreateResultGetter(IServiceScope scope, IClient client, Operation operation)
|
||||
public IDataParser CreateDataParser(IServiceScope scope, Operation operation)
|
||||
{
|
||||
return operation.Type switch
|
||||
{
|
||||
Operation.OperationType.ParseHousesData_15_7_0_1 => new HousesDataParser_15_7_0_1(client, scope, operation),
|
||||
Operation.OperationType.ParseHousesData_15_7_0_1 => new HousesDataParser_15_7_0_1(scope, operation),
|
||||
|
||||
Operation.OperationType.NsiCommon_ExportNsiItem_15_7_0_1 or
|
||||
Operation.OperationType.Nsi_ExportNsiItem_15_7_0_1 => throw new ArgumentException($"Нельзя использовать операцию с типом {operation.Type} для парсинга")
|
||||
|
||||
@ -3,9 +3,9 @@ using Hcs.WebApp.Data.Hcs;
|
||||
|
||||
namespace Hcs.WebApp.BackgroundServices.DataParsers
|
||||
{
|
||||
public class HousesDataParser_15_7_0_1(IClient client, IServiceScope scope, Operation operation) : DataParserBase(client, scope, operation)
|
||||
public class HousesDataParser_15_7_0_1(IServiceScope scope, Operation operation) : DataParserBase(scope, operation)
|
||||
{
|
||||
public override Task<bool> ParseAsync()
|
||||
public override Task ParseAsync()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
@ -2,6 +2,6 @@
|
||||
{
|
||||
public interface IDataParser
|
||||
{
|
||||
Task<bool> ParseAsync();
|
||||
Task ParseAsync();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user