refactor(data-access): remove TVP code and simplify SearchModel
- Remove all List<*FilterEntry> properties and *FilterEnabled computed properties from SearchModel - Delete TableValuedParameterExtensions.cs - Delete entire FilterEntries folder and all filter entry model classes - Delete FilterHandlers folder and all filter handler classes - Delete IFilterHandler interface and FilterResult model - Update MisQueryBuilder to use SQL extraction functions instead of model properties - Update SearchProcessor to get ExtractMisData from database using fn_GetSearchExtractMisData - Update DependencyInjection to remove filter handler registrations - Delete obsolete tests for TVP extensions and filter handlers Filter criteria are now stored as JSON in Search.Criteria column and extracted using SQL functions (fn_GetSearch*) during query execution.
This commit is contained in:
@@ -145,8 +145,13 @@ public sealed class SearchProcessor
|
||||
model.Results = results.ToList();
|
||||
_logger.LogInformation("Search {SearchId} returned {ResultCount} results", model.Id, model.Results.Count);
|
||||
|
||||
// Extract MIS data if requested
|
||||
if (model.ExtractMisData)
|
||||
// Extract MIS data if requested (check ExtractMisData from database using extraction function)
|
||||
var extractMisData = await connection.QuerySingleOrDefaultAsync<bool?>(
|
||||
"SELECT dbo.fn_GetSearchExtractMisData(@SearchId)",
|
||||
new { SearchId = model.Id },
|
||||
commandTimeout: _options.QueryTimeoutSeconds) ?? false;
|
||||
|
||||
if (extractMisData)
|
||||
{
|
||||
await ExecuteMisExtractionAsync(model, connection, ct);
|
||||
}
|
||||
@@ -161,24 +166,14 @@ public sealed class SearchProcessor
|
||||
{
|
||||
_logger.LogDebug("Extracting MIS data for search {SearchId}", model.Id);
|
||||
|
||||
// Build and execute MIS setup SQL
|
||||
var misSetupStatements = _misQueryBuilder.BuildMisExtractionSql(model);
|
||||
var misParameters = new Dictionary<string, object>();
|
||||
|
||||
if (model.MinimumDt.HasValue)
|
||||
{
|
||||
misParameters["p_MinimumDT"] = model.MinimumDt.Value;
|
||||
}
|
||||
if (model.MaximumDt.HasValue)
|
||||
{
|
||||
misParameters["p_MaximumDT"] = model.MaximumDt.Value;
|
||||
}
|
||||
// Build and execute MIS setup SQL (uses temp tables and variables from main query)
|
||||
var misSetupStatements = _misQueryBuilder.BuildMisExtractionSql(model.Id);
|
||||
|
||||
foreach (var sql in misSetupStatements)
|
||||
{
|
||||
await connection.ExecuteAsync(
|
||||
sql,
|
||||
misParameters,
|
||||
new { SearchId = model.Id },
|
||||
commandTimeout: _options.QueryTimeoutSeconds);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user