I need use dependency injection in Blazor WebAssembly app. But there is a situation, my blazor app in UI layer
. I will inject dependency from business layer
and I need inject data layer
too. But UI layer
shouldn't access to data layer. How I can fix this? And another question is, can I adapt Ninject in this Program.cs file?
Program.cs
public class Program
{
public static async Task Main(string[] args)
{
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.Services.AddSingleton<IMyBusiness, MyBusiness>();
builder.Services.AddSingleton<IMyRepository, MyRepository>();
builder.RootComponents.Add<App>("app");
await builder.Build().RunAsync();
}
}