|
3 | 3 |
|
4 | 4 | using System; |
5 | 5 | using System.Collections.Generic; |
6 | | -using System.ComponentModel.Design; |
7 | | -using System.Data; |
8 | 6 | using System.Linq; |
9 | 7 | using System.Threading.Tasks; |
| 8 | +using Autofac; |
| 9 | +using Microsoft.Extensions.Configuration; |
| 10 | +using Microsoft.Extensions.DependencyInjection; |
10 | 11 | using Microsoft.Extensions.Logging; |
11 | 12 | using NuGet.Jobs; |
12 | | -using NuGet.Services.KeyVault; |
13 | | -using NuGet.Services.Sql; |
14 | 13 |
|
15 | 14 | namespace Gallery.Maintenance |
16 | 15 | { |
17 | 16 | /// <summary> |
18 | 17 | /// Runs all <see cref="MaintenanceTask"/>s against the Gallery database. |
19 | 18 | /// </summary> |
20 | | - public class Job : JobBase |
| 19 | + public class Job : JsonConfigurationJob |
21 | 20 | { |
22 | | - |
23 | | - public ISqlConnectionFactory GalleryDatabase { get; private set; } |
24 | | - |
25 | | - public override void Init(IServiceContainer serviceContainer, IDictionary<string, string> jobArgsDictionary) |
26 | | - { |
27 | | - var secretInjector = (ISecretInjector)serviceContainer.GetService(typeof(ISecretInjector)); |
28 | | - var databaseConnectionString = JobConfigurationManager.GetArgument(jobArgsDictionary, JobArgumentNames.GalleryDatabase); |
29 | | - |
30 | | - GalleryDatabase = new AzureSqlConnectionFactory(databaseConnectionString, secretInjector); |
31 | | - } |
32 | | - |
33 | 21 | public override async Task Run() |
34 | 22 | { |
35 | 23 | var failedTasks = new List<string>(); |
@@ -88,5 +76,13 @@ public ILogger CreateTypedLogger(Type type) |
88 | 76 | .MakeGenericMethod(type) |
89 | 77 | .Invoke(null, new object[] { LoggerFactory }) as ILogger; |
90 | 78 | } |
| 79 | + |
| 80 | + protected override void ConfigureAutofacServices(ContainerBuilder containerBuilder) |
| 81 | + { |
| 82 | + } |
| 83 | + |
| 84 | + protected override void ConfigureJobServices(IServiceCollection services, IConfigurationRoot configurationRoot) |
| 85 | + { |
| 86 | + } |
91 | 87 | } |
92 | 88 | } |
0 commit comments