Used nameof expression to resolve parameters name

This commit is contained in:
Dejan Paležević 2015-07-30 13:33:16 -07:00 committed by Kiran Challa
parent c0255f4188
commit 4a9029fc9c
5 changed files with 14 additions and 14 deletions

View File

@ -82,8 +82,8 @@ namespace Microsoft.AspNet.Diagnostics.Entity
public virtual void SetError([NotNull] Type contextType, [NotNull] Exception exception) public virtual void SetError([NotNull] Type contextType, [NotNull] Exception exception)
{ {
Check.NotNull(contextType, "contextType"); Check.NotNull(contextType, nameof(contextType));
Check.NotNull(exception, "exception"); Check.NotNull(exception, nameof(exception));
_contextType = contextType; _contextType = contextType;
_exception = exception; _exception = exception;

View File

@ -11,15 +11,15 @@ namespace Microsoft.AspNet.Builder
{ {
public static IApplicationBuilder UseDatabaseErrorPage([NotNull] this IApplicationBuilder builder) public static IApplicationBuilder UseDatabaseErrorPage([NotNull] this IApplicationBuilder builder)
{ {
Check.NotNull(builder, "builder"); Check.NotNull(builder, nameof(builder));
return builder.UseDatabaseErrorPage(DatabaseErrorPageOptions.ShowAll); return builder.UseDatabaseErrorPage(DatabaseErrorPageOptions.ShowAll);
} }
public static IApplicationBuilder UseDatabaseErrorPage([NotNull] this IApplicationBuilder builder, [NotNull] DatabaseErrorPageOptions options) public static IApplicationBuilder UseDatabaseErrorPage([NotNull] this IApplicationBuilder builder, [NotNull] DatabaseErrorPageOptions options)
{ {
Check.NotNull(builder, "builder"); Check.NotNull(builder, nameof(builder));
Check.NotNull(options, "options"); Check.NotNull(options, nameof(options));
return builder.UseMiddleware<DatabaseErrorPageMiddleware>(options); return builder.UseMiddleware<DatabaseErrorPageMiddleware>(options);
} }

View File

@ -27,10 +27,10 @@ namespace Microsoft.AspNet.Diagnostics.Entity
public DatabaseErrorPageMiddleware([NotNull] RequestDelegate next, [NotNull] IServiceProvider serviceProvider, [NotNull] ILoggerFactory loggerFactory, [NotNull] DatabaseErrorPageOptions options) public DatabaseErrorPageMiddleware([NotNull] RequestDelegate next, [NotNull] IServiceProvider serviceProvider, [NotNull] ILoggerFactory loggerFactory, [NotNull] DatabaseErrorPageOptions options)
{ {
Check.NotNull(next, "next"); Check.NotNull(next, nameof(next));
Check.NotNull(serviceProvider, "serviceProvider"); Check.NotNull(serviceProvider, nameof(serviceProvider));
Check.NotNull(loggerFactory, "loggerFactory"); Check.NotNull(loggerFactory, nameof(loggerFactory));
Check.NotNull(options, "options"); Check.NotNull(options, nameof(options));
_next = next; _next = next;
_serviceProvider = serviceProvider; _serviceProvider = serviceProvider;

View File

@ -8,7 +8,7 @@ namespace Microsoft.AspNet.Diagnostics.Entity
public static DatabaseErrorPageOptions ShowAll => new DatabaseErrorPageOptions public static DatabaseErrorPageOptions ShowAll => new DatabaseErrorPageOptions
{ {
ShowExceptionDetails = true, ShowExceptionDetails = true,
ListMigrations = true, ListMigrations = true
}; };
public virtual bool ShowExceptionDetails { get; set; } public virtual bool ShowExceptionDetails { get; set; }

View File

@ -14,7 +14,7 @@ namespace Microsoft.AspNet.Diagnostics.Entity.Utilities
[ContractAnnotation("value:null => halt")] [ContractAnnotation("value:null => halt")]
public static T NotNull<T>([NoEnumeration] T value, [InvokerParameterName] [NotNull] string parameterName) public static T NotNull<T>([NoEnumeration] T value, [InvokerParameterName] [NotNull] string parameterName)
{ {
NotEmpty(parameterName, "parameterName"); NotEmpty(parameterName, nameof(parameterName));
if (ReferenceEquals(value, null)) if (ReferenceEquals(value, null))
{ {
@ -27,7 +27,7 @@ namespace Microsoft.AspNet.Diagnostics.Entity.Utilities
[ContractAnnotation("value:null => halt")] [ContractAnnotation("value:null => halt")]
public static IReadOnlyList<T> NotEmpty<T>(IReadOnlyList<T> value, [InvokerParameterName] [NotNull] string parameterName) public static IReadOnlyList<T> NotEmpty<T>(IReadOnlyList<T> value, [InvokerParameterName] [NotNull] string parameterName)
{ {
NotEmpty(parameterName, "parameterName"); NotEmpty(parameterName, nameof(parameterName));
NotNull(value, parameterName); NotNull(value, parameterName);
if (value.Count == 0) if (value.Count == 0)
@ -43,7 +43,7 @@ namespace Microsoft.AspNet.Diagnostics.Entity.Utilities
{ {
if (ReferenceEquals(parameterName, null)) if (ReferenceEquals(parameterName, null))
{ {
throw new ArgumentNullException("parameterName"); throw new ArgumentNullException(nameof(parameterName));
} }
if (parameterName.Length == 0) if (parameterName.Length == 0)
@ -67,7 +67,7 @@ namespace Microsoft.AspNet.Diagnostics.Entity.Utilities
public static T IsDefined<T>(T value, [InvokerParameterName] [NotNull] string parameterName) public static T IsDefined<T>(T value, [InvokerParameterName] [NotNull] string parameterName)
where T : struct where T : struct
{ {
NotEmpty(parameterName, "parameterName"); NotEmpty(parameterName, nameof(parameterName));
if (!Enum.IsDefined(typeof(T), value)) if (!Enum.IsDefined(typeof(T), value))
{ {