Created
June 1, 2022 11:42
-
-
Save dhindrik/9108947cbe736ba6b4f1abe295dd211c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Option 1 | |
foreach (var viewModel in assembly.DefinedTypes.Where(e => e.IsSubclassOf(typeof(ViewModel)))) | |
{ | |
builder.Services.AddTransient(viewModel.GetType()); | |
} | |
foreach (var view in assembly.DefinedTypes.Where(e => e.IsSubclassOf(typeof(Views.View)))) | |
{ | |
builder.Services.AddTransient(view.GetType()); | |
} | |
// Option 2 | |
builder.Services.AddTransient<LoadingViewModel>(); | |
builder.Services.AddTransient<LoadingView>(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment