This nuget allows you to view table content of your ASP.NET core application during runtime. The nuget creates a special endpoint and then return tables and data represented in html form.
- Install the nuget:
dotnet add package MaximGorbatyuk.DatabaseSqlEndpoints
- Add routing line into your
Startup.cs
file before UseEndpoints():
class Startup
{
public void Configure(IApplicationBuilder app)
{
// ... some settings
app
.UseSqlEndpoints<AwesomeDbContext>()
.UseTableOutputEndpoint() // default route is /database-sql-endpoints/table
.UseReadEndpoint() // default route is /database-sql-endpoints/read
.UseExecuteEndpoint(); // default route is /database-sql-endpoints/execute
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});
// ... some settings
}
}
Open https:localhost:5001/database-sql-endpoints/table?tableName=<tableName>
in your browser and view your data
Send the following POST request:
POST https:localhost:5001/database-sql-endpoints/read
BODY:
{
"query": "select 1;"
}
Send the following POST request:
POST https:localhost:5001/database-sql-endpoints/execute
BODY:
{
"query": "delete fronm users;"
}