/
rezvich
/
SoapBatchProcessor
Обзор
Документация
Войти
/
rezvich
/
SoapBatchProcessor
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
Data/InputRepository.cs
57 строк
2 KB
rezvich
Подправил токен
04 авг 2026, 12:20
04 авг 2026, 12:20
632636d
Код
Авторство
О чём код?
using Dapper; using Microsoft.Data.SqlClient; namespace SoapBatchProcessor.Data { public enum SearchType { Enp, Dudl, SnilsDr, OIP } public record InputRow( long RequestId, SearchType SearchType, string? ENP, DateTime? Date1, DateTime? Date2, string? DudlSer, string? DudlNum, string? DudlType, string? Snils, DateTime? BirthDay, string? Surname, string? FirstName, string? Patronymic, string? OIP, string? Show ) { public string ExternalRequestId { get; } = Guid.NewGuid().ToString(); } public class InputRepository { private readonly string _cs; private readonly string _sql; private readonly int _timeout; public InputRepository(string cs, string sql, int timeout) { _cs = cs; _sql = sql; _timeout = timeout; } public async Task<List<InputRow>> LoadAsync(int top) { using var con = new SqlConnection(_cs); try { var data = await con.QueryAsync<InputRow>(_sql, new { top }, commandTimeout: _timeout); return data.ToList(); } catch (SqlException ex) { Console.Error.WriteLine($"[SQL] {ex.Message}"); Console.Error.WriteLine("Проверь: 1) имя БД в строке подключения; 2) существует ли объект и схема; 3) права на чтение."); throw; } } } }