pull/1634/head
RachelAppel 2016-07-06 14:42:33 -04:00
commit 07a4dff1b9
5 changed files with 9 additions and 7 deletions

View File

@ -133,7 +133,7 @@ You configure options using the :dn:method:`~Microsoft.Extensions.DependencyInje
:language: c#
:lines: 26-42
:dedent: 8
:emphasize-lines: 7-10,13
:emphasize-lines: 7,10-13
When you bind options to configuration, each property in your options type is bound to a configuration key of the form ``property:subproperty:...``. For example, the ``MyOptions.Option1`` property is bound to the key ``Option1``, which is read from the ``option1`` property in *appsettings.json*. Note that configuration keys are case insensitive.

View File

@ -28,15 +28,15 @@ namespace UsingOptions
// Setup options with DI
services.AddOptions();
// Configure MyOptions using config by installing Microsoft.Extensions.Options.ConfigurationExtensions
services.Configure<MyOptions>(Configuration);
// Configure MyOptions using code
services.Configure<MyOptions>(myOptions =>
{
myOptions.Option1 = "value1_from_action";
});
// Configure MyOptions using config by installing Microsoft.Extensions.Options.ConfigurationExtensions
services.Configure<MyOptions>(Configuration);
// Add framework services.
services.AddMvc();
}

View File

@ -74,7 +74,7 @@ By default, this middleware adds very simple, text-only handlers for common stat
.. image:: error-handling/_static/default-404-status-code.png
The middleware supports several different extension methods. You can pass it a custom lamba expression:
The middleware supports several different extension methods. You can pass it a custom lamdba expression:
.. code-block:: c#
@ -155,4 +155,4 @@ Handling Model State Errors
:doc:`Model validation </mvc/models/validation>` occurs prior to each controller action being invoked, and it is the action methods responsibility to inspect ``ModelState.IsValid`` and react appropriately. In many cases, the appropriate reaction is to return some kind of error response, ideally detailing the reason why model validation failed.
Some apps will choose to follow a standard convention for dealing with model validation errors, in which case a :doc:`filter </mvc/controllers/filters>` may be an appropriate place to implement such a policy. You should test how your actions behave with valid and invalid model states (learn more about :doc:`testing controller logic </mvc/controllers/testing>`).
Some apps will choose to follow a standard convention for dealing with model validation errors, in which case a :doc:`filter </mvc/controllers/filters>` may be an appropriate place to implement such a policy. You should test how your actions behave with valid and invalid model states (learn more about :doc:`testing controller logic </mvc/controllers/testing>`).

View File

@ -1,3 +1,5 @@
:version: 1.0.0-rc1
.. _application-startup:
Application Startup

View File

@ -10,7 +10,7 @@ ASP.NET Core provides cookie :ref:`middleware <fundamentals-middleware>` which s
Adding and configuring
----------------------
The first step is adding the cookie middleware to your application. First use nuget to add the ``Microsoft.AspNetCore.Authentication.Cookies`` package. Then add the following lines to the ``Configure`` method in your *Startup.cs* file;
The first step is adding the cookie middleware to your application. First use nuget to add the ``Microsoft.AspNetCore.Authentication.Cookies`` package. Then add the following lines to the ``Configure`` method in your *Startup.cs* file before the ``app.UseMvc()`` statement;
.. code-block:: c#