File tree 1 file changed +4
-6
lines changed
src/Finbuckle.MultiTenant.AspNetCore/Strategies
1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change 10
10
11
11
namespace Finbuckle . MultiTenant . AspNetCore . Strategies ;
12
12
13
- public class HostStrategy : IMultiTenantStrategy
13
+ public sealed class HostStrategy : IMultiTenantStrategy
14
14
{
15
- private readonly string regex ;
15
+ private readonly Regex regex ;
16
16
17
17
public HostStrategy ( string template )
18
18
{
@@ -62,7 +62,7 @@ public HostStrategy(string template)
62
62
template = template . Replace ( Constants . TenantToken , @"(?<identifier>[^\.]+)" ) ;
63
63
}
64
64
65
- this . regex = $ "^{ template } $";
65
+ this . regex = new Regex ( $ "^{ template } $", RegexOptions . ExplicitCapture | RegexOptions . Compiled , TimeSpan . FromMilliseconds ( 100 ) ) ;
66
66
}
67
67
68
68
public Task < string ? > GetIdentifierAsync ( object context )
@@ -77,9 +77,7 @@ public HostStrategy(string template)
77
77
78
78
string ? identifier = null ;
79
79
80
- var match = Regex . Match ( host . Host , regex ,
81
- RegexOptions . ExplicitCapture ,
82
- TimeSpan . FromMilliseconds ( 100 ) ) ;
80
+ var match = regex . Match ( host . Host ) ;
83
81
84
82
if ( match . Success )
85
83
{
You can’t perform that action at this time.
0 commit comments