PatriQ
PatriQ
CC#
Created by PatriQ on 6/12/2023 in #help
❔ SignalR .NET 7 API Dependency injection not working
public class ScreeningRepository : IScreeningRepository
{
private readonly string tenantId;
public ScreeningRepository(IUserInfo userInfo)
{
//UserInfo here is empty
tenantId = userInfo.GetTenant();
}

public async Task<bool> DoSomething()
{
//Can't do anything because tenantId here is empty
return false;
}
}
public class ScreeningRepository : IScreeningRepository
{
private readonly string tenantId;
public ScreeningRepository(IUserInfo userInfo)
{
//UserInfo here is empty
tenantId = userInfo.GetTenant();
}

public async Task<bool> DoSomething()
{
//Can't do anything because tenantId here is empty
return false;
}
}
Here's the fixed code
14 replies
CC#
Created by PatriQ on 6/12/2023 in #help
❔ SignalR .NET 7 API Dependency injection not working
Hey thanks for answer. Yeah I guess I've given a wrong example. Thats exactly what I'm doing, extracting the tenant data in the constructor.
14 replies