HowlDev.Web.Helpers.DbConnector 1.0.2

Prefix Reserved
dotnet add package HowlDev.Web.Helpers.DbConnector --version 1.0.2
                    
NuGet\Install-Package HowlDev.Web.Helpers.DbConnector -Version 1.0.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="HowlDev.Web.Helpers.DbConnector" Version="1.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="HowlDev.Web.Helpers.DbConnector" Version="1.0.2" />
                    
Directory.Packages.props
<PackageReference Include="HowlDev.Web.Helpers.DbConnector" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add HowlDev.Web.Helpers.DbConnector --version 1.0.2
                    
#r "nuget: HowlDev.Web.Helpers.DbConnector, 1.0.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package HowlDev.Web.Helpers.DbConnector@1.0.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=HowlDev.Web.Helpers.DbConnector&version=1.0.2
                    
Install as a Cake Addin
#tool nuget:?package=HowlDev.Web.Helpers.DbConnector&version=1.0.2
                    
Install as a Cake Tool

DbConnector: NuGet Version WebSockets: NuGet Version

HowlDev.Web.Helpers

Contains a few helpers used often in web projects.

Find a link to the wiki here.

HowlDev.Web.Helpers.DbConnecter

This is a single class that has 4 methods that helps deal with thread pooling from Dapper. It is supposed to be used like the following:

public Task<IEnumerable<Account>> GetAllUsersAsync() =>
    conn.WithConnectionAsync(async conn => {
        var GetUsers = "select p.id, p.accountName, p.role from \"HowlDev.User\" p order by 1";
        try {
            return await conn.QueryAsync<Account>(GetUsers);
        } catch {
            return [];
        }
    }
);

This is a method that returns like a get call, with the important conn.WithConnectionAsync(async conn => {...}) call. In my experience, you run into thread pool locking pretty quick, so it's best just to start by using this.

AI happens to be pretty good at converting old calls into this format if you give it to them.

Changelog

1.0.2 (2/26/26)

  • Small version bump to test new workflow and organization.

1.0.1 (12/15/25)

  • Added workflow file
  • Targeted Net8.0 instead

1.0 (12/13/25)

  • Created

HowlDev.Web.Helpers.WebSockets

This provides a WebSocketService class for use in APIs. This uses the simple WebSocket system provided by C# with no extra dependencies. It is designed as a single-service socket registration (app.Map) and sending messages to only those "subscribed" (which are the ones assigned to the service key). The entire system can be used by the sample code below. (Included in the TestingAPI in the WebSocket directory is a sample html page that displays the minimum requirement to use the socket).

var builder = WebApplication.CreateBuilder(args);

builder.AddWebSocketService<int>();

var app = builder.Build();
app.UseWebSockets();

app.Map("/ws/{id}", async (IWebSocketService service, HttpContext context, int id) => {
    await service.RegisterSocket(context, id);
});

app.MapGet("/post/{id}", async (IWebSocketService service, int id) => {
    await service.SendSocketMessage(id, $"This is the message: coming from id {id} at time {DateTime.Now}");
});

app.Run();

Add the WebSocketService with the key type in the Builder section, the include the UseWebSockets middleware, then just inject the service. I provided the interface that is generic (so you won't get type hints), but you can also request specific versions of the service by using types. So:

app.MapGet("/post/{id}", async (WebSocketService<int> service, int id) => {
    await service.SendSocketMessage(id, $"This is the message: coming from id {id} at time {DateTime.Now}");
});

I'm going to be looking into adding additional parts for the registration method to hopefully configure multiple services if needed, possibly as a group, but you should know that the only restriction for the type is that it is notnull (the only requirement for the dictionary keys). So you could theoretically use more complex objects to register sockets, but I would recommend the primitives int and string.

Changelog

1.1.1 (2/26/26)

  • Small version bump to test new workflow and organization.

1.1.0 (1/1/26)

  • (Okay, I suppose you should read this version as missing the leading 1; I am still exploring what interface I want to make)
  • BREAKING CHANGE: Removed the interface. I originally had it so you didn't have to specify types, but the number of endpoints that you end up dealing with the service is generally quite small, so I've removed that restriction. Now, you need to specify the types as seen in the test API:
app.Map("/ws/{id}", async (WebSocketService<int> service, HttpContext context, int id) => {
    await service.RegisterSocket(context, id);
});

app.MapGet("/post/{id}", async (WebSocketService<int> service, int id) => {
    await service.SendSocketMessage(id, $"This is the message: coming from id {id} at time {DateTime.Now}");
});
  • This also makes differently-typed socket services more clear (and possible; the interface was a good extraction for 1 service, but if you need more, you'd have to strongly type anyways).
  • IMPORTANT: Hooked into IHostApplicationLifetime, which allows me to force close sockets on close of the app, which was super annoying for a time. Now, you close your app, and it closes all the sockets for you instead of having to go hunt down wherever you were debugging (forbid you ever deployed this library to production and couldn't shut down 😛).

1.0.1 (12/25/25) Forgot I accidentally published 1.0 before, so this is the first one I can publish that's actually meaningful.

1.0 (12/25/25)

  • Created
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on HowlDev.Web.Helpers.DbConnector:

Package Downloads
HowlDev.Web.Authentication.AccountAuth

A naive Account/Password auth package with a service and middleware for an API.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.2 93 2/26/2026
1.0.1 1,105 12/16/2025
1.0.0 119 12/13/2025