PM> Install-Package EntityFrameworkCore.SqlProfile
Insert code options.UseSqlProfile();
and routes.MapSqlProfile();
and required using
directive into Startup.cs as follows.
using EntityFrameworkCore.SqlProfile; // Add
....
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
services.AddDbContext<SqliteDbContext>(options =>
{
options.UseSqlite(Configuration.GetConnectionString("Sqlite"));
options.UseSqlProfile(); // Add when use Sqlite
});
....
services.AddDbContext<SqlServerDbContext>(options =>
{
options.UseSqlServer(Configuration.GetConnectionString("SqlServer"));
options.UseSqlProfile(); // Add when use SqlServer
});
....
}
....
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
app.UseMvc(routes =>
{
routes.MapSqlProfile(); // Add
....
});
}
Eg. input https://localhost:44393/logger