This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| async Task FetchDocuments(BatchBlock<Document> batchDocuments, string connectionString, string sql, ProgressTask status) | |
| { | |
| status.Description = "[cyan]Fetching documents from database...[/]"; | |
| using SqlConnection sqlConnection = new(connectionString); | |
| await sqlConnection.OpenAsync(); | |
| // Use READ UNCOMMITTED to avoid holding shared locks while streaming rows. | |
| // This prevents blocking the concurrent UPDATE statements in ProcessMigratedDocuments, | |
| // which operate on the same table. Dirty reads are acceptable here because: | |
| // - We only read rows where the key IS NULL (not yet migrated) | |
| // - Processed rows get a non-NULL key, so they won't be re-read |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT | |
| tl.request_session_id, | |
| tl.resource_type, | |
| tl.resource_description, | |
| tl.request_mode, | |
| tl.request_status, | |
| es.login_name, | |
| es.program_name, | |
| st.text AS sql_text | |
| FROM sys.dm_tran_locks AS tl |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT | |
| blocking.session_id AS blocking_session, | |
| blocked.session_id AS blocked_session, | |
| blocked.wait_type, | |
| blocked.wait_time / 1000.0 AS wait_seconds, | |
| blocked.status, | |
| sq.text AS blocked_sql, | |
| bsq.text AS blocking_sql | |
| FROM sys.dm_exec_requests AS blocked | |
| JOIN sys.dm_exec_sessions AS blocking |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private class FilterComparer : IComparer<Filter> | |
| { | |
| public int Compare(Filter x, Filter y) | |
| { | |
| // Nulls always have to be less than non-nulls | |
| if (x == null && y == null) | |
| { | |
| return 0; | |
| } | |
| if (x == null) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /// <summary> | |
| /// Filter provider for Unity. | |
| /// </summary> | |
| public class UnityFilterAttributeFilterProvider : FilterAttributeFilterProvider | |
| { | |
| private readonly IDependencyResolver _resolver; | |
| /// <summary> | |
| /// Initializes a new instance of the <see cref="UnityFilterAttributeFilterProvider"/> class. | |
| /// </summary> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Parameter objects | |
| public record ProductFilters( | |
| [FromQuery] string? Query, | |
| [FromQuery] string? Category, | |
| [FromQuery] decimal? MinPrice, | |
| [FromQuery] decimal? MaxPrice | |
| ); | |
| public record PaginationParams( | |
| [FromQuery] int Page = 1, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class GetOrderParams | |
| { | |
| [FromRoute] | |
| public int OrderId { get; set; } | |
| [FromHeader(Name = "X-Tenant-Id")] | |
| public string TenantId { get; set; } = default!; | |
| [FromQuery] | |
| public bool IncludeLineItems { get; set; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public record ProductSearchParams( | |
| string? Query, | |
| string? Category, | |
| decimal? MinPrice, | |
| decimal? MaxPrice, | |
| int Page = 1, | |
| int PageSize = 20 | |
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| app.MapGet("/products/search", async ([AsParameters] ProductSearchParams search, ProductsDb db, CancellationToken ct) => | |
| { | |
| // handler logic... | |
| }); |
NewerOlder