Skip to content

Commit

Permalink
Migrate middlware docs (#1513)
Browse files Browse the repository at this point in the history
  • Loading branch information
pakrym authored and Rick-Anderson committed Jun 25, 2016
1 parent 3e03bf4 commit bda750b
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 41 deletions.
2 changes: 1 addition & 1 deletion aspnet/fundamentals/middleware.rst
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ For more complex request handling functionality, the ASP.NET team recommends imp
.. literalinclude:: middleware/sample/src/MiddlewareSample/RequestLoggerMiddleware.cs
:language: c#
:caption: RequestLoggerMiddleware.cs
:emphasize-lines: 13, 19
:emphasize-lines: 12, 18

The middleware follows the `Explicit Dependencies Principle <http://deviq.com/explicit-dependencies-principle/>`_ and exposes all of its dependencies in its constructor. Middleware can take advantage of the `UseMiddleware<T>`_ extension to inject services directly into their constructors, as shown in the example below. Dependency injected services are automatically filled, and the extension takes a ``params`` array of arguments to be used for non-injected parameters.

Expand Down
5 changes: 1 addition & 4 deletions aspnet/fundamentals/middleware/sample/global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
{
"projects": [ "src", "test" ],
"sdk": {
"version": "1.0.0-beta6"
}
"projects": [ "src", "test" ]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System.IO;
using Microsoft.AspNetCore.Hosting;

namespace MiddlewareSample
{
public class Program
{
public static void Main(string[] args)
{
var host = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.Build();

host.Run();
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Microsoft.AspNet.Builder;
using Microsoft.AspNetCore.Builder;

namespace MiddlewareSample
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Http;
using Microsoft.Framework.Logging;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;

namespace MiddlewareSample
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Hosting;
using Microsoft.AspNet.Http;
using Microsoft.Framework.DependencyInjection;
using Microsoft.Framework.Logging;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;

namespace MiddlewareSample
{
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,34 +1,22 @@
{
"webroot": "wwwroot",
"version": "1.0.0-*",

"dependencies": {
"Microsoft.AspNet.Server.IIS": "1.0.0-beta6",
"Microsoft.AspNet.Server.WebListener": "1.0.0-beta6",
"Microsoft.Framework.DependencyInjection": "1.0.0-beta6",
"Microsoft.Framework.Logging": "1.0.0-beta6",
"Microsoft.Framework.Logging.Console": "1.0.0-beta6"
},
"Microsoft.NETCore.App": {
"version": "1.0.0",
"type": "platform"
},

"commands": {
"web": "Microsoft.AspNet.Hosting --config hosting.ini"
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
"Microsoft.Extensions.DependencyInjection": "1.0.0",
"Microsoft.Extensions.Logging": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0"
},

"frameworks": {
"dnx451": { },
"dnxcore50": { }
"netcoreapp1.0": {}
},

"publishExclude": [
"node_modules",
"bower_components",
"**.xproj",
"**.user",
"**.vspscc"
],
"exclude": [
"wwwroot",
"node_modules",
"bower_components"
]
"buildOptions": {
"emitEntryPoint": true
}
}

0 comments on commit bda750b

Please sign in to comment.