-
Like the title says, how do i use the two libraries together? // ...
WebApplicationBuilder Builder = WebApplication.CreateBuilder(args);
Builder.Services.AddMySqlDataSource("Server=/run/mysqld/mysqld.sock; User=...; Password=...; Database=...; Protocol=Unix;");
// ... public class TestEndpoint([FromServices] MySqlDataSource dataSource) : EndpointWithoutRequest {
public override void Configure() {
Get("/api/test");
AllowAnonymous();
}
public override async Task HandleAsync(CancellationToken ct) {
using MySqlConnection Connection = await dataSource.OpenConnectionAsync(ct);
await SendAsync(new { Test = true }, 200, ct);
}
} But i keep getting this exception:
The log output sounds like its instantly closing the pool which would explain the exception, but how do i make it work?
|
Beta Was this translation helpful? Give feedback.
Answered by
Aaron2550
Jul 9, 2024
Replies: 1 comment
-
This was a total error 40 moment, there was a bit of code hidden in a #region block that disposed the data source |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
Aaron2550
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This was a total error 40 moment, there was a bit of code hidden in a #region block that disposed the data source