#311 Move UseMiddleware to Http.Abstractions.

This commit is contained in:
Chris R 2015-05-20 12:42:54 -07:00
parent 83a8fd136f
commit 69849cc37c
3 changed files with 6 additions and 6 deletions

View File

@ -4,9 +4,9 @@
using System; using System;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using Microsoft.Framework.DependencyInjection;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNet.Http; using Microsoft.AspNet.Http;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Builder namespace Microsoft.AspNet.Builder
{ {
@ -27,7 +27,7 @@ namespace Microsoft.AspNet.Builder
var parameters = methodinfo.GetParameters(); var parameters = methodinfo.GetParameters();
if (parameters[0].ParameterType != typeof(HttpContext)) if (parameters[0].ParameterType != typeof(HttpContext))
{ {
throw new Exception("TODO: Middleware Invoke method must take first argument of HttpContext"); throw new Exception("Middleware Invoke method must take first argument of HttpContext");
} }
if (parameters.Length == 1) if (parameters.Length == 1)
{ {
@ -38,7 +38,7 @@ namespace Microsoft.AspNet.Builder
var serviceProvider = context.RequestServices ?? context.ApplicationServices ?? applicationServices; var serviceProvider = context.RequestServices ?? context.ApplicationServices ?? applicationServices;
if (serviceProvider == null) if (serviceProvider == null)
{ {
throw new Exception("TODO: IServiceProvider is not available"); throw new Exception("IServiceProvider is not available");
} }
var arguments = new object[parameters.Length]; var arguments = new object[parameters.Length];
arguments[0] = context; arguments[0] = context;
@ -48,7 +48,7 @@ namespace Microsoft.AspNet.Builder
arguments[index] = serviceProvider.GetService(serviceType); arguments[index] = serviceProvider.GetService(serviceType);
if (arguments[index] == null) if (arguments[index] == null)
{ {
throw new Exception(string.Format("TODO: No service for type '{0}' has been registered.", serviceType)); throw new Exception(string.Format("No service for type '{0}' has been registered.", serviceType));
} }
} }
return (Task)methodinfo.Invoke(instance, arguments); return (Task)methodinfo.Invoke(instance, arguments);

View File

@ -2,6 +2,7 @@
"version": "1.0.0-*", "version": "1.0.0-*",
"description": "ASP.NET 5 HTTP object model. HttpContext and family.", "description": "ASP.NET 5 HTTP object model. HttpContext and family.",
"dependencies": { "dependencies": {
"Microsoft.Framework.ActivatorUtilities.Sources": { "type": "build", "version": "1.0.0-*" },
"Microsoft.Framework.NotNullAttribute.Sources": { "type": "build", "version": "1.0.0-*" }, "Microsoft.Framework.NotNullAttribute.Sources": { "type": "build", "version": "1.0.0-*" },
"Microsoft.Framework.WebEncoders.Core": "1.0.0-*" "Microsoft.Framework.WebEncoders.Core": "1.0.0-*"
}, },
@ -16,6 +17,7 @@
"System.Linq": "4.0.0-beta-*", "System.Linq": "4.0.0-beta-*",
"System.Net.Primitives": "4.0.10-beta-*", "System.Net.Primitives": "4.0.10-beta-*",
"System.Net.WebSockets" : "4.0.0-beta-*", "System.Net.WebSockets" : "4.0.0-beta-*",
"System.Reflection.TypeExtensions": "4.0.0-beta-*",
"System.Runtime": "4.0.20-beta-*", "System.Runtime": "4.0.20-beta-*",
"System.Runtime.InteropServices": "4.0.20-beta-*", "System.Runtime.InteropServices": "4.0.20-beta-*",
"System.Security.Cryptography.X509Certificates": "4.0.0-beta-*", "System.Security.Cryptography.X509Certificates": "4.0.0-beta-*",

View File

@ -4,7 +4,6 @@
"dependencies": { "dependencies": {
"Microsoft.AspNet.Http.Abstractions": "1.0.0-*", "Microsoft.AspNet.Http.Abstractions": "1.0.0-*",
"Microsoft.AspNet.Http.Features": "1.0.0-*", "Microsoft.AspNet.Http.Features": "1.0.0-*",
"Microsoft.Framework.DependencyInjection.Abstractions": "1.0.0-*",
"Microsoft.Framework.NotNullAttribute.Sources": { "type": "build", "version": "1.0.0-*" }, "Microsoft.Framework.NotNullAttribute.Sources": { "type": "build", "version": "1.0.0-*" },
"Microsoft.Framework.WebEncoders.Core": "1.0.0-*", "Microsoft.Framework.WebEncoders.Core": "1.0.0-*",
"Microsoft.Net.Http.Headers": "1.0.0-*" "Microsoft.Net.Http.Headers": "1.0.0-*"
@ -15,7 +14,6 @@
"dnxcore50": { "dnxcore50": {
"dependencies": { "dependencies": {
"System.IO.FileSystem": "4.0.0-beta-*", "System.IO.FileSystem": "4.0.0-beta-*",
"System.Reflection.TypeExtensions": "4.0.0-beta-*",
"System.Runtime": "4.0.20-beta-*" "System.Runtime": "4.0.20-beta-*"
} }
} }