mirror of
https://github.com/AlexMacocian/Net.Maui.Extensions.git
synced 2026-07-15 14:59:31 +00:00
Don't register abstract pages
This commit is contained in:
@@ -67,7 +67,7 @@ public static class MauiAppBuilderExtensions
|
||||
public static MauiAppBuilder WithPages(this MauiAppBuilder appBuilder)
|
||||
{
|
||||
appBuilder.ThrowIfNull();
|
||||
foreach (var pageType in Assembly.GetCallingAssembly()?.GetTypes()?.Where(t => t.IsAssignableTo(typeof(ContentPage))) ?? [])
|
||||
foreach (var pageType in Assembly.GetCallingAssembly()?.GetTypes()?.Where(t => t.IsAssignableTo(typeof(ContentPage)) && !t.IsAbstract && !t.IsInterface) ?? [])
|
||||
{
|
||||
appBuilder.Services.AddScoped(pageType);
|
||||
appBuilder.Services.AddScoped(typeof(ContentPage), sp => sp.GetRequiredService(pageType));
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<IsPackable>true</IsPackable>
|
||||
<Version>0.2.8</Version>
|
||||
<Version>0.2.9</Version>
|
||||
<Authors>Alexandru Macocian</Authors>
|
||||
<PackageLicenseFile>LICENSE</PackageLicenseFile>
|
||||
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
|
||||
|
||||
Reference in New Issue
Block a user