Using [NotNull]

This commit is contained in:
Hisham Abdullah Bin Ateya 2015-05-07 00:32:34 +03:00
parent 8508c6256e
commit 1f36174da5
5 changed files with 11 additions and 42 deletions

View File

@ -6,6 +6,7 @@
using System;
using Microsoft.AspNet.Abstractions;
using Microsoft.AspNet.Diagnostics;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Builder
{
@ -20,13 +21,8 @@ namespace Microsoft.AspNet.Builder
/// <param name="builder"></param>
/// <param name="options"></param>
/// <returns></returns>
public static IApplicationBuilder UseDiagnosticsPage(this IApplicationBuilder builder, DiagnosticsPageOptions options)
public static IApplicationBuilder UseDiagnosticsPage([NotNull] this IApplicationBuilder builder, DiagnosticsPageOptions options)
{
if (builder == null)
{
throw new ArgumentNullException("builder");
}
return builder.Use(next => new DiagnosticsPageMiddleware(next, options).Invoke);
}

View File

@ -3,6 +3,7 @@
using System;
using Microsoft.AspNet.Diagnostics;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Builder
{
@ -17,13 +18,8 @@ namespace Microsoft.AspNet.Builder
/// </summary>
/// <param name="builder"></param>
/// <returns></returns>
public static IApplicationBuilder UseErrorPage(this IApplicationBuilder builder)
public static IApplicationBuilder UseErrorPage([NotNull] this IApplicationBuilder builder)
{
if (builder == null)
{
throw new ArgumentNullException("builder");
}
return builder.UseErrorPage(new ErrorPageOptions());
}
@ -34,12 +30,8 @@ namespace Microsoft.AspNet.Builder
/// <param name="builder"></param>
/// <param name="options"></param>
/// <returns></returns>
public static IApplicationBuilder UseErrorPage(this IApplicationBuilder builder, ErrorPageOptions options)
public static IApplicationBuilder UseErrorPage([NotNull] this IApplicationBuilder builder, ErrorPageOptions options)
{
if (builder == null)
{
throw new ArgumentNullException("builder");
}
/* TODO: Development, Staging, or Production
string appMode = new AppProperties(builder.Properties).Get<string>(Constants.HostAppMode);
bool isDevMode = string.Equals(Constants.DevMode, appMode, StringComparison.Ordinal);*/

View File

@ -13,6 +13,7 @@ using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Diagnostics.Views;
using Microsoft.AspNet.Http;
using Microsoft.Framework.Runtime;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Diagnostics
{
@ -31,16 +32,8 @@ namespace Microsoft.AspNet.Diagnostics
/// <param name="next"></param>
/// <param name="options"></param>
/// <param name="isDevMode"></param>
public ErrorPageMiddleware(RequestDelegate next, ErrorPageOptions options, bool isDevMode)
public ErrorPageMiddleware([NotNull] RequestDelegate next, [NotNull] ErrorPageOptions options, bool isDevMode)
{
if (next == null)
{
throw new ArgumentNullException("next");
}
if (options == null)
{
throw new ArgumentNullException("options");
}
if (isDevMode)
{
options.SetDefaultVisibility(isVisible: true);

View File

@ -5,6 +5,7 @@
using System;
using Microsoft.AspNet.Http;
using Microsoft.AspNet.Diagnostics;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Builder
{
@ -19,13 +20,8 @@ namespace Microsoft.AspNet.Builder
/// <param name="builder"></param>
/// <param name="options"></param>
/// <returns></returns>
public static IApplicationBuilder UseWelcomePage(this IApplicationBuilder builder, WelcomePageOptions options)
public static IApplicationBuilder UseWelcomePage([NotNull] this IApplicationBuilder builder, WelcomePageOptions options)
{
if (builder == null)
{
throw new ArgumentNullException("builder");
}
return builder.Use(next => new WelcomePageMiddleware(next, options).Invoke);
}

View File

@ -8,6 +8,7 @@ using System.Threading.Tasks;
using Microsoft.AspNet.Diagnostics.Views;
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Http;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Diagnostics
{
@ -24,17 +25,8 @@ namespace Microsoft.AspNet.Diagnostics
/// </summary>
/// <param name="next"></param>
/// <param name="options"></param>
public WelcomePageMiddleware(RequestDelegate next, WelcomePageOptions options)
public WelcomePageMiddleware([NotNull] RequestDelegate next, [NotNull] WelcomePageOptions options)
{
if (next == null)
{
throw new ArgumentNullException("next");
}
if (options == null)
{
throw new ArgumentNullException("options");
}
_next = next;
_options = options;
}