Skip to content

Commit 6a18a8f

Browse files
committed
Upgrade to ASP.NET 5 beta3
1 parent 5cc051c commit 6a18a8f

File tree

7 files changed

+47
-32
lines changed

7 files changed

+47
-32
lines changed

src/React.AspNet5/HttpContextLifetimeProvider.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
using System;
1111
using System.Collections.Concurrent;
1212
using System.Linq;
13+
using Microsoft.AspNet.Hosting;
1314
using Microsoft.AspNet.Http;
1415
using Microsoft.Framework.DependencyInjection;
1516
using React.TinyIoC;
@@ -46,7 +47,7 @@ public HttpContextLifetimeProvider(IServiceProvider appServiceProvider)
4647
/// Gets the <see cref="HttpContext" /> of the current request.
4748
/// </summary>
4849
private HttpContext HttpContext =>
49-
_appServiceProvider.GetRequiredService<IContextAccessor<HttpContext>>().Value;
50+
_appServiceProvider.GetRequiredService<IHttpContextAccessor>().Value;
5051

5152
/// <summary>
5253
/// Gets the current per-request registrations for the current request.

src/React.AspNet5/JsxFileMiddleware.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ private StaticFileMiddleware CreateFileMiddleware(IJsxTransformer jsxTransformer
8383
OnPrepareResponse = _options.StaticFileOptions.OnPrepareResponse,
8484
RequestPath = _options.StaticFileOptions.RequestPath,
8585
ServeUnknownFileTypes = _options.StaticFileOptions.ServeUnknownFileTypes,
86-
FileSystem = new JsxFileSystem(
86+
FileProvider = new JsxFileSystem(
8787
jsxTransformer,
88-
_options.StaticFileOptions.FileSystem ?? _hostingEnv.WebRootFileSystem,
88+
_options.StaticFileOptions.FileProvider ?? _hostingEnv.WebRootFileProvider,
8989
_options.Extensions
9090
)
9191
},

src/React.AspNet5/JsxFileSystem.cs

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@
1616
using Microsoft.Owin.FileSystems;
1717
using IOwinFileSystem = Microsoft.Owin.FileSystems.IFileSystem;
1818
#else
19-
using Microsoft.AspNet.FileSystems;
19+
using Microsoft.AspNet.FileProviders;
2020
using Microsoft.Framework.Expiration.Interfaces;
21-
using IOwinFileSystem = Microsoft.AspNet.FileSystems.IFileSystem;
21+
using IOwinFileSystem = Microsoft.AspNet.FileProviders.IFileProvider;
22+
using PhysicalFileSystem = Microsoft.AspNet.FileProviders.PhysicalFileProvider;
2223
#endif
2324

2425
#if OWIN
@@ -126,6 +127,20 @@ public IDirectoryContents GetDirectoryContents(string subpath)
126127
{
127128
return _physicalFileSystem.GetDirectoryContents(subpath);
128129
}
130+
131+
/// <summary>
132+
/// Creates a change trigger with the specified filter.
133+
/// </summary>
134+
/// <param name="filter">
135+
/// Filter string used to determine what files or folders to monitor. Example: **/*.cs, *.*, subFolder/**/*.cshtml.
136+
/// </param>
137+
/// <returns>
138+
/// An <see cref="IExpirationTrigger"/> that is triggered when a file matching <paramref name="filter"/> is added, modified or deleted.
139+
/// </returns>
140+
public IExpirationTrigger Watch(string filter)
141+
{
142+
return _physicalFileSystem.Watch(filter);
143+
}
129144
#endif
130145

131146
private class JsxFileInfo : IFileInfo
@@ -164,17 +179,22 @@ public string Name
164179
get { return _fileInfo.Name; }
165180
}
166181

182+
public bool IsDirectory
183+
{
184+
get { return _fileInfo.IsDirectory; }
185+
}
186+
187+
#if OWIN
167188
public DateTime LastModified
168189
{
169190
get { return _fileInfo.LastModified; }
170191
}
171-
172-
public bool IsDirectory
192+
#else
193+
public DateTimeOffset LastModified
173194
{
174-
get { return _fileInfo.IsDirectory; }
195+
get { return _fileInfo.LastModified; }
175196
}
176197

177-
#if !OWIN
178198
public void WriteContent(byte[] content)
179199
{
180200
_fileInfo.WriteContent(content);
@@ -185,11 +205,6 @@ public void Delete()
185205
_fileInfo.Delete();
186206
}
187207

188-
public IExpirationTrigger CreateFileChangeTrigger()
189-
{
190-
return _fileInfo.CreateFileChangeTrigger();
191-
}
192-
193208
public bool Exists
194209
{
195210
get { return _fileInfo.Exists; }

src/React.AspNet5/React.AspNet5.kproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
1212
<OutputPath Condition="'$(OutputPath)'=='' ">..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
1313
</PropertyGroup>
14+
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
15+
<AssemblyName>React.AspNet5</AssemblyName>
16+
</PropertyGroup>
1417
<PropertyGroup>
1518
<SchemaVersion>2.0</SchemaVersion>
1619
</PropertyGroup>

src/React.AspNet5/project.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
},
1515
},
1616
"dependencies": {
17-
"Microsoft.Framework.DependencyInjection": "1.0.0.0-beta2",
18-
"Microsoft.AspNet.Hosting": "1.0.0.0-beta2",
19-
"Microsoft.AspNet.Mvc.Core": "6.0.0.0-beta2",
20-
"Microsoft.AspNet.StaticFiles": "1.0.0.0-beta2",
17+
"Microsoft.Framework.DependencyInjection": "1.0.0.0-beta3",
18+
"Microsoft.AspNet.Hosting": "1.0.0.0-beta3",
19+
"Microsoft.AspNet.Mvc.Core": "6.0.0.0-beta3",
20+
"Microsoft.AspNet.StaticFiles": "1.0.0.0-beta3",
2121
"React": ""
2222
},
2323

src/React.Sample.Mvc6/Startup.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@
1010
using System;
1111
using Microsoft.AspNet.Builder;
1212
using Microsoft.AspNet.Diagnostics;
13-
using Microsoft.AspNet.Diagnostics.Entity;
1413
using Microsoft.AspNet.Hosting;
15-
using Microsoft.AspNet.Routing;
1614
using Microsoft.Framework.ConfigurationModel;
1715
using Microsoft.Framework.DependencyInjection;
1816
using Microsoft.Framework.Logging;
@@ -52,9 +50,8 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
5250
// Add the following to the request pipeline only in development environment.
5351
if (string.Equals(env.EnvironmentName, "Development", StringComparison.OrdinalIgnoreCase))
5452
{
55-
app.UseBrowserLink();
53+
//app.UseBrowserLink();
5654
app.UseErrorPage(ErrorPageOptions.ShowAll);
57-
app.UseDatabaseErrorPage(DatabaseErrorPageOptions.ShowAll);
5855
}
5956
else
6057
{

src/React.Sample.Mvc6/project.json

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,15 @@
33
"webroot": "wwwroot",
44
"version": "1.0.0-*",
55
"dependencies": {
6-
"Microsoft.AspNet.Mvc": "6.0.0-beta2",
7-
"Microsoft.AspNet.Diagnostics": "1.0.0-beta2",
8-
"Microsoft.AspNet.Diagnostics.Entity": "7.0.0-beta2",
9-
"Microsoft.AspNet.Server.IIS": "1.0.0-beta2",
10-
"Microsoft.AspNet.Server.WebListener": "1.0.0-beta2",
11-
"Microsoft.AspNet.StaticFiles": "1.0.0-beta2",
12-
"Microsoft.Framework.ConfigurationModel.Json": "1.0.0-beta2",
13-
"Microsoft.Framework.CodeGenerators.Mvc": "1.0.0-beta2",
14-
"Microsoft.Framework.Logging": "1.0.0-beta2",
15-
"Microsoft.Framework.Logging.Console": "1.0.0-beta2",
6+
"Microsoft.AspNet.Mvc": "6.0.0.0-beta3",
7+
"Microsoft.AspNet.Diagnostics": "1.0.0.0-beta3",
8+
"Microsoft.AspNet.Server.IIS": "1.0.0.0-beta3",
9+
"Microsoft.AspNet.Server.WebListener": "1.0.0.0-beta3",
10+
"Microsoft.AspNet.StaticFiles": "1.0.0.0-beta3",
11+
"Microsoft.Framework.ConfigurationModel.Json": "1.0.0.0-beta3",
12+
"Microsoft.Framework.CodeGenerators.Mvc": "1.0.0.0-beta3",
13+
"Microsoft.Framework.Logging": "1.0.0.0-beta3",
14+
"Microsoft.Framework.Logging.Console": "1.0.0.0-beta3",
1615
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-beta1",
1716
"React.AspNet5": ""
1817
},

0 commit comments

Comments
 (0)