11using System ;
2+ using System . Diagnostics . CodeAnalysis ;
23using Prism . Mvvm ;
34
45namespace Prism . Ioc
@@ -14,7 +15,7 @@ public static class IContainerRegistryExtensions
1415 /// <typeparam name="TView">The Type of object to register as the dialog</typeparam>
1516 /// <param name="containerRegistry"></param>
1617 /// <param name="name">The unique name to register with the dialog.</param>
17- public static void RegisterDialog < TView > ( this IContainerRegistry containerRegistry , string name = null )
18+ public static void RegisterDialog < [ DynamicallyAccessedMembers ( DynamicallyAccessedMemberTypes . PublicConstructors | DynamicallyAccessedMemberTypes . NonPublicConstructors ) ] TView > ( this IContainerRegistry containerRegistry , string name = null )
1819 {
1920 containerRegistry . RegisterForNavigation < TView > ( name ) ;
2021 }
@@ -26,7 +27,7 @@ public static void RegisterDialog<TView>(this IContainerRegistry containerRegist
2627 /// <typeparam name="TViewModel">The ViewModel to use as the DataContext for the dialog</typeparam>
2728 /// <param name="containerRegistry"></param>
2829 /// <param name="name">The unique name to register with the dialog.</param>
29- public static void RegisterDialog < TView , TViewModel > ( this IContainerRegistry containerRegistry , string name = null ) where TViewModel : Dialogs . IDialogAware
30+ public static void RegisterDialog < [ DynamicallyAccessedMembers ( DynamicallyAccessedMemberTypes . PublicConstructors | DynamicallyAccessedMemberTypes . NonPublicConstructors ) ] TView , [ DynamicallyAccessedMembers ( DynamicallyAccessedMemberTypes . PublicConstructors | DynamicallyAccessedMemberTypes . NonPublicConstructors ) ] TViewModel > ( this IContainerRegistry containerRegistry , string name = null ) where TViewModel : Dialogs . IDialogAware
3031 {
3132 containerRegistry . RegisterForNavigation < TView , TViewModel > ( name ) ;
3233 }
@@ -36,7 +37,7 @@ public static void RegisterDialog<TView, TViewModel>(this IContainerRegistry con
3637 /// </summary>
3738 /// <typeparam name="TWindow">The Type of the Window class that will be used to host dialogs in the IDialogService</typeparam>
3839 /// <param name="containerRegistry"></param>
39- public static void RegisterDialogWindow < TWindow > ( this IContainerRegistry containerRegistry ) where TWindow : Dialogs . IDialogWindow
40+ public static void RegisterDialogWindow < [ DynamicallyAccessedMembers ( DynamicallyAccessedMemberTypes . PublicConstructors | DynamicallyAccessedMemberTypes . NonPublicConstructors ) ] TWindow > ( this IContainerRegistry containerRegistry ) where TWindow : Dialogs . IDialogWindow
4041 {
4142 containerRegistry . Register ( typeof ( Dialogs . IDialogWindow ) , typeof ( TWindow ) ) ;
4243 }
@@ -47,7 +48,7 @@ public static void RegisterDialogWindow<TWindow>(this IContainerRegistry contain
4748 /// <typeparam name="TWindow">The Type of the Window class that will be used to host dialogs in the IDialogService</typeparam>
4849 /// <param name="containerRegistry"></param>
4950 /// <param name="name">The name of the dialog window</param>
50- public static void RegisterDialogWindow < TWindow > ( this IContainerRegistry containerRegistry , string name ) where TWindow : Dialogs . IDialogWindow
51+ public static void RegisterDialogWindow < [ DynamicallyAccessedMembers ( DynamicallyAccessedMemberTypes . PublicConstructors | DynamicallyAccessedMemberTypes . NonPublicConstructors ) ] TWindow > ( this IContainerRegistry containerRegistry , string name ) where TWindow : Dialogs . IDialogWindow
5152 {
5253 containerRegistry . Register ( typeof ( Dialogs . IDialogWindow ) , typeof ( TWindow ) , name ) ;
5354 }
@@ -69,7 +70,7 @@ public static void RegisterForNavigation(this IContainerRegistry containerRegist
6970 /// <typeparam name="T">The Type of the object to register as the view</typeparam>
7071 /// <param name="containerRegistry"></param>
7172 /// <param name="name">The unique name to register with the object.</param>
72- public static void RegisterForNavigation < T > ( this IContainerRegistry containerRegistry , string name = null )
73+ public static void RegisterForNavigation < [ DynamicallyAccessedMembers ( DynamicallyAccessedMemberTypes . PublicConstructors | DynamicallyAccessedMemberTypes . NonPublicConstructors ) ] T > ( this IContainerRegistry containerRegistry , string name = null )
7374 {
7475 Type type = typeof ( T ) ;
7576 string viewName = string . IsNullOrWhiteSpace ( name ) ? type . Name : name ;
@@ -83,12 +84,12 @@ public static void RegisterForNavigation<T>(this IContainerRegistry containerReg
8384 /// <typeparam name="TViewModel">The ViewModel to use as the DataContext for the view</typeparam>
8485 /// <param name="containerRegistry"></param>
8586 /// <param name="name">The unique name to register with the view</param>
86- public static void RegisterForNavigation < TView , TViewModel > ( this IContainerRegistry containerRegistry , string name = null )
87+ public static void RegisterForNavigation < [ DynamicallyAccessedMembers ( DynamicallyAccessedMemberTypes . PublicConstructors | DynamicallyAccessedMemberTypes . NonPublicConstructors ) ] TView , [ DynamicallyAccessedMembers ( DynamicallyAccessedMemberTypes . PublicConstructors | DynamicallyAccessedMemberTypes . NonPublicConstructors ) ] TViewModel > ( this IContainerRegistry containerRegistry , string name = null )
8788 {
8889 containerRegistry . RegisterForNavigationWithViewModel < TViewModel > ( typeof ( TView ) , name ) ;
8990 }
9091
91- private static void RegisterForNavigationWithViewModel < TViewModel > ( this IContainerRegistry containerRegistry , Type viewType , string name )
92+ private static void RegisterForNavigationWithViewModel < [ DynamicallyAccessedMembers ( DynamicallyAccessedMemberTypes . PublicConstructors | DynamicallyAccessedMemberTypes . NonPublicConstructors ) ] TViewModel > ( this IContainerRegistry containerRegistry , Type viewType , string name )
9293 {
9394 if ( string . IsNullOrWhiteSpace ( name ) )
9495 name = viewType . Name ;
0 commit comments