// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore;
using Microsoft.Extensions.Options;
namespace Microsoft.AspNetCore.Builder
{
///
/// extension methods for the .
///
public static class MigrationsEndPointExtensions
{
///
/// Processes requests to execute migrations operations. The middleware will listen for requests made to .
///
/// The to register the middleware with.
/// The same instance so that multiple calls can be chained.
public static IApplicationBuilder UseMigrationsEndPoint(this IApplicationBuilder app)
{
if (app == null)
{
throw new ArgumentNullException(nameof(app));
}
return app.UseMigrationsEndPoint(new MigrationsEndPointOptions());
}
///
/// Processes requests to execute migrations operations. The middleware will listen for requests to the path configured in .
///
/// The to register the middleware with.
/// An action to set the options for the middleware.
/// The same instance so that multiple calls can be chained.
public static IApplicationBuilder UseMigrationsEndPoint(this IApplicationBuilder app, MigrationsEndPointOptions options)
{
if (app == null)
{
throw new ArgumentNullException(nameof(app));
}
if (options == null)
{
throw new ArgumentNullException(nameof(options));
}
return app.UseMiddleware(Options.Create(options));
}
}
}