-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve registration exclusions (#32)
* Added ignore attribute and also ignore abstracts * Cast ignored types to immutable hashset * Added demo project test for ignore atribute
- Loading branch information
1 parent
ff594da
commit 88b83a2
Showing
6 changed files
with
59 additions
and
3 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
namespace DemoProject.Pages; | ||
|
||
/// <summary> | ||
/// This page has a dependency on a service that should not be registered. Runtime exception expected when navigating to this page. | ||
/// </summary> | ||
public class BrokenPage : ContentPage | ||
{ | ||
public BrokenPage(IIgnoredService ignoredService) | ||
{ | ||
Content = new VerticalStackLayout | ||
{ | ||
Children = { | ||
new Label { HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, Text = ignoredService.GetHello() | ||
} | ||
} | ||
}; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using Maui.Plugins.PageResolver.Attributes; | ||
|
||
namespace DemoProject.Services; | ||
|
||
public interface IIgnoredService | ||
{ | ||
string GetHello(); | ||
} | ||
|
||
[Ignore] | ||
public class IgnoredService : IIgnoredService | ||
{ | ||
public string GetHello() => "Hello"; | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
namespace Maui.Plugins.PageResolver.Attributes; | ||
|
||
[AttributeUsage(AttributeTargets.Class, Inherited = false)] | ||
public class IgnoreAttribute : Attribute { } |
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