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)
{
Check.NotNull(contextType, "contextType");
Check.NotNull(exception, "exception");
Check.NotNull(contextType, nameof(contextType));
Check.NotNull(exception, nameof(exception));
_contextType = contextType;
_exception = exception;

View File

@ -11,15 +11,15 @@ namespace Microsoft.AspNet.Builder
{
public static IApplicationBuilder UseDatabaseErrorPage([NotNull] this IApplicationBuilder builder)
{
Check.NotNull(builder, "builder");
Check.NotNull(builder, nameof(builder));
return builder.UseDatabaseErrorPage(DatabaseErrorPageOptions.ShowAll);
}
public static IApplicationBuilder UseDatabaseErrorPage([NotNull] this IApplicationBuilder builder, [NotNull] DatabaseErrorPageOptions options)
{
Check.NotNull(builder, "builder");
Check.NotNull(options, "options");
Check.NotNull(builder, nameof(builder));
Check.NotNull(options, nameof(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)
{
Check.NotNull(next, "next");
Check.NotNull(serviceProvider, "serviceProvider");
Check.NotNull(loggerFactory, "loggerFactory");
Check.NotNull(options, "options");
Check.NotNull(next, nameof(next));
Check.NotNull(serviceProvider, nameof(serviceProvider));
Check.NotNull(loggerFactory, nameof(loggerFactory));
Check.NotNull(options, nameof(options));
_next = next;
_serviceProvider = serviceProvider;

View File

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

View File

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