-
Notifications
You must be signed in to change notification settings - Fork 4
Dependency Injection #1
Copy link
Copy link
Open
Description
Having dependency injection available would be great!
I do love the ASP.NET application builder pattern and it might fit in here too
For the example it would probably look something like this
var builder = DrawieApplication.CreateBuilder(); // This would, alongside creating a builder with a service collection, add a DrawingEngine service
builder.Services.AddGlfwWindowing();
builder.Services.AddVulkanRenderApi();
builder.Services.AddSkiaBackend();
builder.Services.AddWindow<MainWindow>();
SkiaDrawingBackend drawingBackend = new SkiaDrawingBackend();
VulkanRenderApi renderApi = new VulkanRenderApi();
GlfwWindowingPlatform windowingPlatform = new GlfwWindowingPlatform(renderApi);
var app = builder.Build();
// Do some more initialization related stuff or CMD argument logic
app.Run<MainWindow>();Dependency injection can be still be useful even if you don't want to use the application builder pattern
Note that the classless Program.cs file pattern is only available for Desktop and Web targets (so no android, not sure about ios)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels