示例#1
0
 /// <summary>
 /// Configures services to provide CSLA Blazor
 /// WebAssembly client support
 /// </summary>
 /// <param name="builder">ICslaBuilder instance</param>
 /// <returns></returns>
 private static ICslaBuilder WithBlazorClientSupport(this ICslaBuilder builder)
 {
     builder.Services.AddTransient(typeof(ViewModel <>), typeof(ViewModel <>));
     builder.Services.AddSingleton <IAuthorizationPolicyProvider, CslaPermissionsPolicyProvider>();
     builder.Services.AddSingleton <IAuthorizationHandler, CslaPermissionsHandler>();
     return(builder);
 }
示例#2
0
 /// <summary>
 /// Configures services to provide CSLA Blazor server support
 /// </summary>
 /// <param name="builder">ICslaBuilder instance</param>
 /// <returns></returns>
 public static ICslaBuilder WithBlazorServerSupport(this ICslaBuilder builder)
 {
     CslaConfiguration.Configure().DataPortal().AuthenticationType("Windows");
     builder.Services.AddTransient(typeof(ViewModel <>), typeof(ViewModel <>));
     builder.Services.AddSingleton <IAuthorizationPolicyProvider, CslaPermissionsPolicyProvider>();
     builder.Services.AddSingleton <IAuthorizationHandler, CslaPermissionsHandler>();
     return(builder);
 }
 /// <summary>
 /// Configures services to provide CSLA Blazor server support
 /// </summary>
 /// <param name="builder">ICslaBuilder instance</param>
 /// <param name="options">Options object</param>
 /// <returns></returns>
 public static ICslaBuilder WithBlazorServerSupport(this ICslaBuilder builder, BlazorServerConfigurationOptions options = null)
 {
     if (options == null)
     {
         options = new BlazorServerConfigurationOptions();
     }
     builder.Services.TryAddTransient(typeof(ViewModel <>), typeof(ViewModel <>));
     if (options.UseCslaPermissionsPolicy)
     {
         builder.Services.AddSingleton <IAuthorizationPolicyProvider, CslaPermissionsPolicyProvider>();
         builder.Services.AddSingleton <IAuthorizationHandler, CslaPermissionsHandler>();
     }
     return(builder);
 }