Skip to content

Commit 04c3451

Browse files
authored
Merge pull request #1460 from TechnologyEnhancedLearning/MergeRc1
Merge Hotfix release changes to RC
2 parents 9582e95 + 9a94bfc commit 04c3451

File tree

55 files changed

+379
-84
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+379
-84
lines changed

AdminUI/LearningHub.Nhs.AdminUI/LearningHub.Nhs.AdminUI.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,13 @@
8383
<PackageReference Include="Azure.Storage.Blobs" Version="12.23.0" />
8484
<PackageReference Include="Azure.Storage.Files.Shares" Version="12.8.0" />
8585
<PackageReference Include="BuildWebCompiler" Version="1.12.405" />
86-
<PackageReference Include="elfhHub.Nhs.Models" Version="3.0.12" />
86+
<PackageReference Include="elfhHub.Nhs.Models" Version="3.0.13" />
8787
<PackageReference Include="FluentValidation" Version="11.11.0" />
8888
<PackageReference Include="FluentValidation.AspNetCore" Version="11.3.0" />
8989
<PackageReference Include="HtmlSanitizer" Version="6.0.453" />
9090
<PackageReference Include="IdentityModel" Version="4.6.0" />
9191
<PackageReference Include="LearningHub.Nhs.Caching" Version="2.0.2" />
92-
<PackageReference Include="LearningHub.Nhs.Models" Version="3.0.57" />
92+
<PackageReference Include="LearningHub.Nhs.Models" Version="3.0.59" />
9393
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.19.0" />
9494
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="6.0.36" />
9595
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="6.0.36" />

LearningHub.Nhs.WebUI.AutomatedUiTests/LearningHub.Nhs.WebUI.AutomatedUiTests.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
</PropertyGroup>
1212

1313
<ItemGroup>
14-
<PackageReference Include="elfhHub.Nhs.Models" Version="3.0.12" />
14+
<PackageReference Include="elfhHub.Nhs.Models" Version="3.0.13" />
1515
<PackageReference Include="FluentAssertions" Version="6.12.0" />
16-
<PackageReference Include="LearningHub.Nhs.Models" Version="3.0.57" />
16+
<PackageReference Include="LearningHub.Nhs.Models" Version="3.0.59" />
1717
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="3.1.13" />
1818
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
1919
<PackageReference Include="Selenium.Axe" Version="4.0.19" />

LearningHub.Nhs.WebUI/LearningHub.Nhs.WebUI.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,13 @@
107107
<PackageReference Include="AspNetCoreRateLimit" Version="5.0.0" />
108108
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="8.1.1" />
109109
<PackageReference Include="Azure.Storage.Blobs" Version="12.23.0" />
110-
<PackageReference Include="elfhHub.Nhs.Models" Version="3.0.12" />
110+
<PackageReference Include="elfhHub.Nhs.Models" Version="3.0.13" />
111111
<PackageReference Include="FluentValidation.AspNetCore" Version="11.3.0" />
112112
<PackageReference Include="GDS.MultiPageFormData" Version="1.0.6" />
113113
<PackageReference Include="HtmlAgilityPack" Version="1.11.72" />
114114
<PackageReference Include="IdentityModel" Version="4.6.0" />
115115
<PackageReference Include="LearningHub.Nhs.Caching" Version="2.0.0" />
116-
<PackageReference Include="LearningHub.Nhs.Models" Version="3.0.57" />
116+
<PackageReference Include="LearningHub.Nhs.Models" Version="3.0.59" />
117117
<PackageReference Include="linqtotwitter" Version="6.9.0" />
118118
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.19.0" />
119119
<PackageReference Include="Microsoft.ApplicationInsights.EventCounterCollector" Version="2.21.0" />

OpenAPI/LearningHub.Nhs.OpenApi.Models/Configuration/LearningHubConfig.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ public class LearningHubConfig
4747
/// </summary>
4848
public bool UseRedisCache { get; set; } = false;
4949

50+
/// <summary>
51+
/// Gets or sets <see cref="MaxDatabaseRetryAttempts"/>.
52+
/// </summary>
53+
public int MaxDatabaseRetryAttempts { get; set; } = 0;
54+
5055
/// <summary>
5156
/// Gets or sets <see cref="HierarchyEditPublishQueueName"/>.
5257
/// </summary>

OpenAPI/LearningHub.Nhs.OpenApi.Models/LearningHub.Nhs.OpenApi.Models.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
</PropertyGroup>
1717

1818
<ItemGroup>
19-
<PackageReference Include="LearningHub.Nhs.Models" Version="3.0.57" />
19+
<PackageReference Include="LearningHub.Nhs.Models" Version="3.0.59" />
2020
<PackageReference Include="NLog.Web.AspNetCore" Version="4.15.0" />
2121
</ItemGroup>
2222

OpenAPI/LearningHub.Nhs.OpenApi.Repositories.Interface/LearningHub.Nhs.OpenApi.Repositories.Interface.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
</PropertyGroup>
1818

1919
<ItemGroup>
20-
<PackageReference Include="LearningHub.Nhs.Models" Version="3.0.57" />
20+
<PackageReference Include="LearningHub.Nhs.Models" Version="3.0.59" />
2121
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.7" />
2222
</ItemGroup>
2323

OpenAPI/LearningHub.Nhs.OpenApi.Repositories/EntityFramework/LearningHubDbContext.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ namespace LearningHub.Nhs.OpenApi.Repositories.EntityFramework
1515
using LearningHub.Nhs.Models.Hierarchy;
1616
using LearningHub.Nhs.Models.Messaging;
1717
using LearningHub.Nhs.Models.MyLearning;
18+
using LearningHub.Nhs.Models.Notification;
1819
using LearningHub.Nhs.Models.Resource;
1920
using LearningHub.Nhs.Models.Resource.ResourceDisplay;
2021
using LearningHub.Nhs.Models.User;
@@ -124,6 +125,11 @@ public LearningHubDbContextOptions Options
124125
/// </summary>
125126
public virtual DbSet<Notification> Notification { get; set; }
126127

128+
/// <summary>
129+
/// Gets or sets the Notification Count.
130+
/// </summary>
131+
public virtual DbSet<NotificationCount> NotificationCount { get; set; }
132+
127133
/// <summary>
128134
/// Gets or sets the user notification..
129135
/// </summary>

OpenAPI/LearningHub.Nhs.OpenApi.Repositories/EntityFramework/ServiceMappings.cs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,11 +187,21 @@ public static void AddLearningHubMappings(this IServiceCollection services, ICon
187187
// External
188188
services.AddSingleton<IEntityTypeMap, UserProfileMap>();
189189

190-
var dbContextOptions = new DbContextOptionsBuilder<LearningHubDbContext>()
191-
.UseSqlServer(configuration.GetConnectionString("LearningHubDbConnection")).Options;
190+
// Configure LearningHubDbContextOptions per scope (per request)
191+
services.AddScoped(sp =>
192+
{
193+
var dbOptions = sp.GetRequiredService<DbContextOptions<LearningHubDbContext>>();
194+
var mappings = sp.GetServices<IEntityTypeMap>();
195+
return new LearningHubDbContextOptions(dbOptions, mappings);
196+
});
192197

193-
services.AddSingleton(dbContextOptions);
194-
services.AddSingleton<LearningHubDbContextOptions>();
198+
// Configure DbContext
199+
var maxDatabaseRetryAttempts = configuration.GetValue<int>("LearningHub:MaxDatabaseRetryAttempts");
200+
services.AddDbContext<LearningHubDbContext>(options =>
201+
options.UseSqlServer(
202+
configuration.GetConnectionString("LearningHubDbConnection"),
203+
sqlOptions => sqlOptions.EnableRetryOnFailure(maxDatabaseRetryAttempts)
204+
));
195205
}
196206
}
197207
}

OpenAPI/LearningHub.Nhs.OpenApi.Repositories/LearningHub.Nhs.OpenApi.Repositories.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<PackageReference Include="AutoMapper" Version="10.1.1" />
2525
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="8.1.1" />
2626
<PackageReference Include="IdentityModel" Version="4.6.0" />
27-
<PackageReference Include="LearningHub.Nhs.Models" Version="3.0.57" />
27+
<PackageReference Include="LearningHub.Nhs.Models" Version="3.0.59" />
2828
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.20" />
2929
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="7.0.20" />
3030
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.20" />

OpenAPI/LearningHub.Nhs.OpenApi.Repositories/Repositories/Activity/ScormActivityRepository.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,12 +220,13 @@ public async Task<bool> CheckUserScormActivitySuspendDataToBeCleared(int lastSco
220220

221221
private async Task UpdateScormActivityAsync(int userId, ScormActivity updatedScormActivity)
222222
{
223-
var existingScormActivity = DbContext.ScormActivity.Where(s => s.Id == updatedScormActivity.Id)
223+
var existingScormActivity = this.DbContext.ScormActivity.Where(s => s.Id == updatedScormActivity.Id)
224224
.Include(sao => sao.ScormActivityObjective)
225225
.Include(sao => sao.ScormActivityInteraction)
226226
.ThenInclude(sai => sai.ScormActivityInteractionCorrectResponse)
227227
.Include(sai => sai.ScormActivityInteraction)
228228
.ThenInclude(sai => sai.ScormActivityInteractionObjective)
229+
.AsSplitQuery()
229230
.SingleOrDefault();
230231

231232
updatedScormActivity.ResourceActivityId = existingScormActivity.ResourceActivityId;

0 commit comments

Comments
 (0)