File tree 3 files changed +11
-23
lines changed
3 files changed +11
-23
lines changed Original file line number Diff line number Diff line change 10
10
using System ;
11
11
using System . Collections . Generic ;
12
12
using System . Linq ;
13
- using System . Web ;
14
13
using System . Web . Caching ;
15
14
16
15
namespace React . Web
@@ -28,10 +27,10 @@ public class AspNetCache : ICache
28
27
/// <summary>
29
28
/// Initializes a new instance of the <see cref="AspNetCache"/> class.
30
29
/// </summary>
31
- /// <param name="context ">The HTTP context </param>
32
- public AspNetCache ( HttpContextBase context )
30
+ /// <param name="cache ">The Web application cache </param>
31
+ public AspNetCache ( Cache cache )
33
32
{
34
- _cache = context . Cache ;
33
+ _cache = cache ;
35
34
}
36
35
37
36
/// <summary>
@@ -62,8 +61,9 @@ public AspNetCache(HttpContextBase context)
62
61
/// will be cleared automatically
63
62
/// </param>
64
63
public void Set < T > (
65
- string key , T data ,
66
- TimeSpan slidingExpiration ,
64
+ string key ,
65
+ T data ,
66
+ TimeSpan slidingExpiration ,
67
67
IEnumerable < string > cacheDependencyFiles = null
68
68
)
69
69
{
Original file line number Diff line number Diff line change 7
7
* of patent rights can be found in the PATENTS file in the same directory.
8
8
*/
9
9
10
- using System . Web ;
10
+ using System . Web . Hosting ;
11
11
12
12
namespace React . Web
13
13
{
@@ -17,28 +17,14 @@ namespace React.Web
17
17
/// </summary>
18
18
public class AspNetFileSystem : FileSystemBase
19
19
{
20
- /// <summary>
21
- /// The ASP.NET server utilities
22
- /// </summary>
23
- private readonly HttpServerUtilityBase _serverUtility ;
24
-
25
- /// <summary>
26
- /// Initializes a new instance of the <see cref="AspNetFileSystem"/> class.
27
- /// </summary>
28
- /// <param name="serverUtility">The server utility.</param>
29
- public AspNetFileSystem ( HttpServerUtilityBase serverUtility )
30
- {
31
- _serverUtility = serverUtility ;
32
- }
33
-
34
20
/// <summary>
35
21
/// Converts a path from an application relative path (~/...) to a full filesystem path
36
22
/// </summary>
37
23
/// <param name="relativePath">App-relative path of the file</param>
38
24
/// <returns>Full path of the file</returns>
39
25
public override string MapPath ( string relativePath )
40
26
{
41
- return _serverUtility . MapPath ( relativePath ) ;
27
+ return HostingEnvironment . MapPath ( relativePath ) ;
42
28
}
43
29
}
44
30
}
Original file line number Diff line number Diff line change 9
9
10
10
using System . Diagnostics ;
11
11
using System . Web ;
12
+ using System . Web . Caching ;
12
13
using System . Web . Hosting ;
13
14
using React . TinyIoC ;
14
15
@@ -47,14 +48,15 @@ public void Register(TinyIoCContainer container)
47
48
}
48
49
else
49
50
{
50
- container . Register < ICache , AspNetCache > ( ) . AsPerRequestSingleton ( ) ;
51
+ container . Register < ICache , AspNetCache > ( ) . AsPerRequestSingleton ( ) ;
51
52
}
52
53
53
54
// Wrappers for built-in objects
54
55
container . Register < HttpContextBase > ( ( c , o ) => new HttpContextWrapper ( HttpContext . Current ) ) ;
55
56
container . Register < HttpServerUtilityBase > ( ( c , o ) => c . Resolve < HttpContextBase > ( ) . Server ) ;
56
57
container . Register < HttpRequestBase > ( ( c , o ) => c . Resolve < HttpContextBase > ( ) . Request ) ;
57
58
container . Register < HttpResponseBase > ( ( c , o ) => c . Resolve < HttpContextBase > ( ) . Response ) ;
59
+ container . Register < Cache > ( ( c , o ) => HttpRuntime . Cache ) ;
58
60
}
59
61
60
62
/// <summary>
You can’t perform that action at this time.
0 commit comments