mirror of
https://github.com/Sea-Haven-Industries/shoc-backend.git
synced 2026-10-07 16:19:07 +00:00
Compare commits
1 commit
4847e8fec5
...
e4e1e5caeb
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e4e1e5caeb |
3 changed files with 3 additions and 18 deletions
|
|
@ -547,7 +547,9 @@ namespace SeaHaven.DataServices.Implementation
|
|||
{
|
||||
var number = exceptionType.GetProperty("Number")?.GetValue(databaseException) as int?;
|
||||
return number is 2601 or 2627
|
||||
&& IsActiveDispatchIndexViolationMessage(databaseException.Message);
|
||||
&& databaseException.Message.Contains(
|
||||
"IX_DispatchUpliftRequests_DispatchId",
|
||||
StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
if (provider?.Contains("Sqlite", StringComparison.OrdinalIgnoreCase) == true
|
||||
|
|
@ -574,12 +576,6 @@ namespace SeaHaven.DataServices.Implementation
|
|||
return false;
|
||||
}
|
||||
|
||||
internal static bool IsActiveDispatchIndexViolationMessage(string message)
|
||||
{
|
||||
const string activeDispatchIndex = "'IX_DispatchUpliftRequests_DispatchId'";
|
||||
return message.Contains(activeDispatchIndex, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
public async Task<T> ExecuteWorkOrderMutationAsync<T>(
|
||||
int workOrderId,
|
||||
Func<CancellationToken, Task<T>> work,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
using System.Runtime.CompilerServices;
|
||||
|
||||
[assembly: InternalsVisibleTo("Api.SeaHavenIndustries.Tests")]
|
||||
[assembly: InternalsVisibleTo("SeaHavenIndustries.Tests")]
|
||||
|
|
|
|||
|
|
@ -9,16 +9,6 @@ namespace SeaHavenIndustries.Tests;
|
|||
|
||||
public sealed class UpliftDataServiceTransactionTests
|
||||
{
|
||||
[Theory]
|
||||
[InlineData("Cannot insert duplicate key row with unique index 'IX_DispatchUpliftRequests_DispatchId'.", true)]
|
||||
[InlineData("Cannot insert duplicate key row with unique index 'IX_DispatchUpliftRequests_DispatchId_RequestKey'.", false)]
|
||||
public void IsActiveDispatchIndexViolationMessage_MatchesOnlyTheActiveDispatchIndex(
|
||||
string message,
|
||||
bool expected)
|
||||
{
|
||||
Assert.Equal(expected, UpliftDataService.IsActiveDispatchIndexViolationMessage(message));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task SaveChangesAsync_ActiveUpliftOnSameDispatch_MapsConcurrentInsertConflict()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue