-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
Usage:
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddControllersWithViews();
builder.Services.AddDataTables("sqlite", "Data Source=./db.sqlite"); // <----------- NEW!
var app = builder.Build();
app.UseStaticFiles();
app.MapDefaultControllerRoute();
app.Run();Usage:
public CarsController(Database db) : ControllerBase // new primary constructors
{
[HttpGet("DataTable")]
[HttpPost("DataTable")]
public ActionResult<DtResponse> GetDataTable()
{
// db.XYZ
}
}I have created my own but I am having other issues with my approach in the context of integration tests with TestHost and a custom WebApplicationFactory.
DbProviderFactories.RegisterFactory("Microsoft.Data.Sqlite", SqlClientFactory.Instance);
services.AddScoped((sp) =>
{
return new Database("sqlite", sqliteConnectionString, "Microsoft.Data.Sqlite");
});Metadata
Metadata
Assignees
Labels
No labels