Skip to content

Commit

Permalink
Upgrade to ASP.NET 5 beta3
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel15 committed Feb 26, 2015
1 parent 5cc051c commit 6a18a8f
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 32 deletions.
3 changes: 2 additions & 1 deletion src/React.AspNet5/HttpContextLifetimeProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using System;
using System.Collections.Concurrent;
using System.Linq;
using Microsoft.AspNet.Hosting;
using Microsoft.AspNet.Http;
using Microsoft.Framework.DependencyInjection;
using React.TinyIoC;
Expand Down Expand Up @@ -46,7 +47,7 @@ public HttpContextLifetimeProvider(IServiceProvider appServiceProvider)
/// Gets the <see cref="HttpContext" /> of the current request.
/// </summary>
private HttpContext HttpContext =>
_appServiceProvider.GetRequiredService<IContextAccessor<HttpContext>>().Value;
_appServiceProvider.GetRequiredService<IHttpContextAccessor>().Value;

/// <summary>
/// Gets the current per-request registrations for the current request.
Expand Down
4 changes: 2 additions & 2 deletions src/React.AspNet5/JsxFileMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ private StaticFileMiddleware CreateFileMiddleware(IJsxTransformer jsxTransformer
OnPrepareResponse = _options.StaticFileOptions.OnPrepareResponse,
RequestPath = _options.StaticFileOptions.RequestPath,
ServeUnknownFileTypes = _options.StaticFileOptions.ServeUnknownFileTypes,
FileSystem = new JsxFileSystem(
FileProvider = new JsxFileSystem(
jsxTransformer,
_options.StaticFileOptions.FileSystem ?? _hostingEnv.WebRootFileSystem,
_options.StaticFileOptions.FileProvider ?? _hostingEnv.WebRootFileProvider,
_options.Extensions
)
},
Expand Down
37 changes: 26 additions & 11 deletions src/React.AspNet5/JsxFileSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@
using Microsoft.Owin.FileSystems;
using IOwinFileSystem = Microsoft.Owin.FileSystems.IFileSystem;
#else
using Microsoft.AspNet.FileSystems;
using Microsoft.AspNet.FileProviders;
using Microsoft.Framework.Expiration.Interfaces;
using IOwinFileSystem = Microsoft.AspNet.FileSystems.IFileSystem;
using IOwinFileSystem = Microsoft.AspNet.FileProviders.IFileProvider;
using PhysicalFileSystem = Microsoft.AspNet.FileProviders.PhysicalFileProvider;
#endif

#if OWIN
Expand Down Expand Up @@ -126,6 +127,20 @@ public IDirectoryContents GetDirectoryContents(string subpath)
{
return _physicalFileSystem.GetDirectoryContents(subpath);
}

/// <summary>
/// Creates a change trigger with the specified filter.
/// </summary>
/// <param name="filter">
/// Filter string used to determine what files or folders to monitor. Example: **/*.cs, *.*, subFolder/**/*.cshtml.
/// </param>
/// <returns>
/// An <see cref="IExpirationTrigger"/> that is triggered when a file matching <paramref name="filter"/> is added, modified or deleted.
/// </returns>
public IExpirationTrigger Watch(string filter)
{
return _physicalFileSystem.Watch(filter);
}
#endif

private class JsxFileInfo : IFileInfo
Expand Down Expand Up @@ -164,17 +179,22 @@ public string Name
get { return _fileInfo.Name; }
}

public bool IsDirectory
{
get { return _fileInfo.IsDirectory; }
}

#if OWIN
public DateTime LastModified
{
get { return _fileInfo.LastModified; }
}

public bool IsDirectory
#else
public DateTimeOffset LastModified
{
get { return _fileInfo.IsDirectory; }
get { return _fileInfo.LastModified; }
}

#if !OWIN
public void WriteContent(byte[] content)
{
_fileInfo.WriteContent(content);
Expand All @@ -185,11 +205,6 @@ public void Delete()
_fileInfo.Delete();
}

public IExpirationTrigger CreateFileChangeTrigger()
{
return _fileInfo.CreateFileChangeTrigger();
}

public bool Exists
{
get { return _fileInfo.Exists; }
Expand Down
3 changes: 3 additions & 0 deletions src/React.AspNet5/React.AspNet5.kproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<AssemblyName>React.AspNet5</AssemblyName>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
Expand Down
8 changes: 4 additions & 4 deletions src/React.AspNet5/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
},
},
"dependencies": {
"Microsoft.Framework.DependencyInjection": "1.0.0.0-beta2",
"Microsoft.AspNet.Hosting": "1.0.0.0-beta2",
"Microsoft.AspNet.Mvc.Core": "6.0.0.0-beta2",
"Microsoft.AspNet.StaticFiles": "1.0.0.0-beta2",
"Microsoft.Framework.DependencyInjection": "1.0.0.0-beta3",
"Microsoft.AspNet.Hosting": "1.0.0.0-beta3",
"Microsoft.AspNet.Mvc.Core": "6.0.0.0-beta3",
"Microsoft.AspNet.StaticFiles": "1.0.0.0-beta3",
"React": ""
},

Expand Down
5 changes: 1 addition & 4 deletions src/React.Sample.Mvc6/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
using System;
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Diagnostics;
using Microsoft.AspNet.Diagnostics.Entity;
using Microsoft.AspNet.Hosting;
using Microsoft.AspNet.Routing;
using Microsoft.Framework.ConfigurationModel;
using Microsoft.Framework.DependencyInjection;
using Microsoft.Framework.Logging;
Expand Down Expand Up @@ -52,9 +50,8 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
// Add the following to the request pipeline only in development environment.
if (string.Equals(env.EnvironmentName, "Development", StringComparison.OrdinalIgnoreCase))
{
app.UseBrowserLink();
//app.UseBrowserLink();
app.UseErrorPage(ErrorPageOptions.ShowAll);
app.UseDatabaseErrorPage(DatabaseErrorPageOptions.ShowAll);
}
else
{
Expand Down
19 changes: 9 additions & 10 deletions src/React.Sample.Mvc6/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@
"webroot": "wwwroot",
"version": "1.0.0-*",
"dependencies": {
"Microsoft.AspNet.Mvc": "6.0.0-beta2",
"Microsoft.AspNet.Diagnostics": "1.0.0-beta2",
"Microsoft.AspNet.Diagnostics.Entity": "7.0.0-beta2",
"Microsoft.AspNet.Server.IIS": "1.0.0-beta2",
"Microsoft.AspNet.Server.WebListener": "1.0.0-beta2",
"Microsoft.AspNet.StaticFiles": "1.0.0-beta2",
"Microsoft.Framework.ConfigurationModel.Json": "1.0.0-beta2",
"Microsoft.Framework.CodeGenerators.Mvc": "1.0.0-beta2",
"Microsoft.Framework.Logging": "1.0.0-beta2",
"Microsoft.Framework.Logging.Console": "1.0.0-beta2",
"Microsoft.AspNet.Mvc": "6.0.0.0-beta3",
"Microsoft.AspNet.Diagnostics": "1.0.0.0-beta3",
"Microsoft.AspNet.Server.IIS": "1.0.0.0-beta3",
"Microsoft.AspNet.Server.WebListener": "1.0.0.0-beta3",
"Microsoft.AspNet.StaticFiles": "1.0.0.0-beta3",
"Microsoft.Framework.ConfigurationModel.Json": "1.0.0.0-beta3",
"Microsoft.Framework.CodeGenerators.Mvc": "1.0.0.0-beta3",
"Microsoft.Framework.Logging": "1.0.0.0-beta3",
"Microsoft.Framework.Logging.Console": "1.0.0.0-beta3",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-beta1",
"React.AspNet5": ""
},
Expand Down

0 comments on commit 6a18a8f

Please sign in to comment.