-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathOptimizelyNotFoundHandlerOptions.cs
More file actions
65 lines (54 loc) · 2.36 KB
/
Copy pathOptimizelyNotFoundHandlerOptions.cs
File metadata and controls
65 lines (54 loc) · 2.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// Copyright (c) Geta Digital. All rights reserved.
// Licensed under Apache-2.0. See the LICENSE file in the project root for more information
using System;
using System.Collections.Generic;
using Geta.NotFoundHandler.Core.Redirects;
using Geta.NotFoundHandler.Optimizely.Core.AutomaticRedirects;
namespace Geta.NotFoundHandler.Optimizely.Infrastructure.Configuration
{
public class OptimizelyNotFoundHandlerOptions
{
public const string Section = "Geta:NotFoundHandler:Optimizely";
public const int CurrentDbVersion = 3;
public bool AutomaticRedirectsEnabled { get; set; }
public RedirectType AutomaticRedirectType { get; set; } = RedirectType.Temporary;
/// <summary>
/// Number of moved content keys the "Register content move redirects" job loads per page.
/// The job processes the table page-by-page so it scales to large NotFoundHandler tables.
/// </summary>
public int MovedContentBatchSize { get; set; } = 1000;
private readonly List<Type> _contentKeyProviders = new();
public IEnumerable<Type> ContentKeyProviders => _contentKeyProviders;
private readonly List<Type> _contentLinkProviders = new();
public IEnumerable<Type> ContentLinkProviders => _contentLinkProviders;
private readonly List<Type> _contentUrlProviders = new();
public IEnumerable<Type> ContentUrlProviders => _contentUrlProviders;
public OptimizelyNotFoundHandlerOptions()
{
AddContentKeyProviders<CmsContentKeyProvider>();
AddContentLinkProviders<CmsContentLinkProvider>();
AddContentUrlProviders<CmsContentUrlProvider>();
}
public OptimizelyNotFoundHandlerOptions AddContentKeyProviders<T>()
where T : IContentKeyProvider
{
var t = typeof(T);
_contentKeyProviders.Add(t);
return this;
}
public OptimizelyNotFoundHandlerOptions AddContentLinkProviders<T>()
where T : IContentLinkProvider
{
var t = typeof(T);
_contentLinkProviders.Add(t);
return this;
}
public OptimizelyNotFoundHandlerOptions AddContentUrlProviders<T>()
where T : IContentUrlProvider
{
var t = typeof(T);
_contentUrlProviders.Add(t);
return this;
}
}
}