예제 #1
0
 /// <summary>
 /// Configure the builder by default from attributes.
 /// </summary>
 /// <param name="builder"></param>
 /// <param name="type"></param>
 /// <returns></returns>
 public static IRazorComponentClientModuleManifestBuilder WithDefaultsFromModuleType(this IRazorComponentClientModuleManifestBuilder builder, Type type)
 {
     {
         var attrs = type.GetCustomAttributes <ModuleUIResourceAttribute>();
         foreach (var attr in attrs)
         {
             builder.WithResource(new UIResource(attr.Type, attr.Path)
             {
                 Attributes = attr.Attributes
             });
         }
     }
     {
         var attrs = type.GetCustomAttributes <ModuleUIGlobalComponentAttribute>();
         foreach (var attr in attrs)
         {
             builder.WithGlobalComponent(attr.Type);
         }
     }
     {
         var attr = type.GetCustomAttribute <ModulePageProviderAttribute>();
         if (attr is not null)
         {
             builder.WithPageProvider(attr.Type);
         }
     }
     return(builder);
 }
예제 #2
0
 /// <summary>
 /// Add global component to manifest.
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="builder"></param>
 /// <returns></returns>
 public static IRazorComponentClientModuleManifestBuilder WithGlobalComponent <T>(this IRazorComponentClientModuleManifestBuilder builder) where T : IComponent => builder.WithGlobalComponent(typeof(T));