File tree Expand file tree Collapse file tree 8 files changed +78
-8
lines changed
React.Sample.Mvc4/Content Expand file tree Collapse file tree 8 files changed +78
-8
lines changed Original file line number Diff line number Diff line change @@ -106,4 +106,4 @@ var Avatar = React.createClass({
106106 getPhotoUrl : function ( author ) {
107107 return 'http://graph.facebook.com/' + author . Facebook + '/picture' ;
108108 }
109- } ) ;
109+ } ) ;
Original file line number Diff line number Diff line change @@ -37,9 +37,19 @@ public void Register(TinyIoCContainer container)
3737
3838 // Unique per request
3939 container . Register < IFileSystem , AspNetFileSystem > ( ) . AsPerRequestSingleton ( ) ;
40- container . Register < ICache , AspNetCache > ( ) . AsPerRequestSingleton ( ) ;
4140 container . Register < IJsxHandler , JsxHandler > ( ) . AsPerRequestSingleton ( ) ;
4241
42+ // Mono for Mac OS does not properly handle caching
43+ // TODO: Remove this once https://bugzilla.xamarin.com/show_bug.cgi?id=19071 is fixed
44+ if ( SystemEnvironmentUtils . IsRunningOnMac ( ) )
45+ {
46+ container . Register < ICache , NullCache > ( ) . AsSingleton ( ) ;
47+ }
48+ else
49+ {
50+ container . Register < ICache , AspNetCache > ( ) . AsPerRequestSingleton ( ) ;
51+ }
52+
4353 // Wrappers for built-in objects
4454 container . Register < HttpContextBase > ( ( c , o ) => new HttpContextWrapper ( HttpContext . Current ) ) ;
4555 container . Register < HttpServerUtilityBase > ( ( c , o ) => c . Resolve < HttpContextBase > ( ) . Server ) ;
Original file line number Diff line number Diff line change 11<configuration>
22 <system.web>
3- <!-- Uncomment if using IIS 7 Classic Mode or IIS 6 -->
3+ <!-- Uncomment if using IIS 7 Classic Mode, IIS 6, or Mono -->
44 <!--
55 <httpHandlers>
66 <add verb="GET" path="*.jsx" type="React.Web.JsxHandlerFactory, React.Web" />
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ public void Execute()
5151 var result = _environment . JsxTransformer . TransformJsxFile ( relativePath ) ;
5252
5353 // Only cache on the server-side for now
54- _response . AddCacheDependency ( new CacheDependency ( _fileSystem . MapPath ( relativePath ) ) ) ;
54+ _response . AddFileDependency ( _fileSystem . MapPath ( relativePath ) ) ;
5555 _response . Cache . SetCacheability ( HttpCacheability . Server ) ;
5656 _response . Cache . SetLastModifiedFromFileDependencies ( ) ;
5757 _response . Cache . SetETagFromFileDependencies ( ) ;
Original file line number Diff line number Diff line change 77 * of patent rights can be found in the PATENTS file in the same directory.
88 */
99
10- using JavaScriptEngineSwitcher . Msie ;
11- using JavaScriptEngineSwitcher . Msie . Configuration ;
1210using React . TinyIoC ;
1311
1412namespace React
Original file line number Diff line number Diff line change 99
1010using System ;
1111using System . IO ;
12- using System . Security . Cryptography ;
13- using System . Text ;
1412using Newtonsoft . Json ;
1513using React . Exceptions ;
1614
Original file line number Diff line number Diff line change 8383 <Link >Properties\SharedAssemblyVersionInfo.cs</Link >
8484 </Compile >
8585 <Compile Include =" AssemblyRegistration.cs" />
86+ <Compile Include =" SystemEnvironmentUtils.cs" />
8687 <Compile Include =" Exceptions\JsxUnsupportedEngineException.cs" />
8788 <Compile Include =" Exceptions\ReactConfigurationException.cs" />
8889 <Compile Include =" Exceptions\ReactException.cs" />
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright (c) 2014, Facebook, Inc.
3+ * All rights reserved.
4+ *
5+ * This source code is licensed under the BSD-style license found in the
6+ * LICENSE file in the root directory of this source tree. An additional grant
7+ * of patent rights can be found in the PATENTS file in the same directory.
8+ */
9+
10+ using System ;
11+ using System . Runtime . InteropServices ;
12+
13+ namespace React
14+ {
15+ /// <summary>
16+ /// Utility functions for handling system environmental differences
17+ /// </summary>
18+ public class SystemEnvironmentUtils
19+ {
20+ [ DllImport ( "libc" ) ]
21+ private static extern int uname ( IntPtr buf ) ;
22+
23+ /// <summary>
24+ /// Determines whether the application is running on Mac OS.
25+ /// Based off Mono's XplatUI.cs, licensed under LGPL.
26+ /// </summary>
27+ /// <returns><c>true</c> if running on Mac OS</returns>
28+ public static bool IsRunningOnMac ( )
29+ {
30+ return _isRunningOnMac . Value ;
31+ }
32+
33+ private readonly static Lazy < bool > _isRunningOnMac = new Lazy < bool > ( ( ) =>
34+ {
35+ if ( Environment . OSVersion . Platform != PlatformID . Unix )
36+ {
37+ return false ;
38+ }
39+
40+ var buf = IntPtr . Zero ;
41+ try
42+ {
43+ buf = Marshal . AllocHGlobal ( 8192 ) ;
44+ if ( uname ( buf ) == 0 )
45+ {
46+ string os = Marshal . PtrToStringAnsi ( buf ) ;
47+ if ( os == "Darwin" )
48+ return true ;
49+ }
50+ }
51+ catch
52+ {
53+ // YOLO
54+ }
55+ finally
56+ {
57+ if ( buf != IntPtr . Zero )
58+ Marshal . FreeHGlobal ( buf ) ;
59+ }
60+ return false ;
61+ } ) ;
62+ }
63+ }
You can’t perform that action at this time.
0 commit comments