Add extensions for DI
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 30/100
Research direction
Start with the WebApplication.CreateBuilder and AddDataTables usage shown in the issue, then review the Database registration and the TestHost/custom WebApplicationFactory context. Confirm the intended dependency-injection extension surface and how it should behave in integration tests. Done means the registration works for the shown SQLite setup without the reported testing issues.
Written by the indexing model from the issue text.
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");
});
- Dominant language
- C#
- Stars
- 19
- Forks
- 11
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from DataTables/NET
-
Async methods? Open
Difficulty 5/5 Over a week Newbie friendliness 25/100
DataTables/NET#25 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
DataTables/NET#24 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
DataTables/NET#18 · 2 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
DataTables/NET#17 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
DataTables/NET#16 · 1 comment ·
Similar issues
-
type/automation type/tech-debt
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
t/bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
ci-failure-cause test-failure
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
area:auth FE mvp P3
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
klasolsson81/jobbliggaren#1788 ·