BurkusCat / Burkus.Mvvm.Maui

A simple MVVM framework for .NET MAUI. It provides: navigation, lifecycle events, parameter passing, native dialog abstractions, and testability.
MIT License
25 stars 5 forks source link

[Feature] View and viewmodel auto-registration #4

Open BurkusCat opened 11 months ago

BurkusCat commented 11 months ago

Is your feature request related to a problem? Please describe. Based on the naming/folder structure, automatically register dependencies

Describe the solution you'd like If I have a view called HomePage and a viewmodel called HomeViewModel (or HomePageViewModel) then both of these dependencies should be automatically registered).

There should be a default schema/configuration for registering dependencies named in a certain way as transient dependencies (should services be auto-registered as singletons?). It should be possible to provide a configuration the BurkusMvvmBuilder to provide custom naming rules and overrides for dependency registration.

Auto-registration should be opt-in as it could lead to unexpected behaviour if enabled by default. Should reflection be used? Is it possible to use source generators for this?

Describe alternatives you've considered Manual registration of dependencies.

Proposed APIs If possible, try to propose how the API might look. For example:

// BurkusMvvmBuilder
.AutoRegisterDependencies();

.AutoRegisterDependencies(configuration??);

Additional context N/A