-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Is there an easy way to make this work? Overloading breaks runtime DI, using IDbContextFactory<DataContext> ctx inside of HubInterface breaks Tapper.
[Hub]
public interface IInventoryHub
{
Task<Shelf[]> GetShelves();
}
public class InventoryHub : Hub<IInventoryReceiver>
{
public async Task<Shelf[]> GetShelves(IDbContextFactory<DataContext> ctx)
{
await using var db = await ctx.CreateDbContextAsync();
var shelves = db.Shelves.ToArray();
return shelves;
}
}Edit:
it is possible to use DI in constructor
public class InventoryHub(IDbContextFactory<DataContext> ctx) : Hub<IInventoryReceiver>, IInventoryHuband it works, so not big deal
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request