Esempio n. 1
0
 /// <summary>
 /// Configures the application to use CSLA .NET
 /// </summary>
 /// <param name="app">ApplicationBuilder object</param>
 /// <param name="config">Implement to configure CSLA .NET</param>
 public static IApplicationBuilder UseCsla(
     this IApplicationBuilder app, Action <CslaConfiguration> config)
 {
     ApplicationContext.DefaultServiceProvider = app.ApplicationServices;
     config?.Invoke(CslaConfiguration.Configure());
     return(app);
 }
Esempio n. 2
0
 /// <summary>
 /// Add CSLA .NET services for use by the application.
 /// </summary>
 /// <param name="services">ServiceCollection object</param>
 /// <param name="config">Implement to configure CSLA .NET</param>
 public static ICslaBuilder AddCsla(this IServiceCollection services, Action <CslaConfiguration> config)
 {
     ApplicationContext.SetServiceCollection(services);
     services.AddTransient(typeof(IDataPortal <>), typeof(DataPortal <>));
     config?.Invoke(CslaConfiguration.Configure());
     return(new CslaBuilder(services));
 }
Esempio n. 3
0
 /// <summary>
 /// Configures the application to use CSLA .NET
 /// </summary>
 /// <param name="builder">IHostBuilder instance</param>
 /// <param name="config">Implement to configure CSLA .NET</param>
 public static HostBuilder UseCsla(
     this HostBuilder builder, Action <CslaConfiguration> config)
 {
     CslaConfiguration.Configure().
     ContextManager(typeof(Csla.Windows.ApplicationContextManager));
     config?.Invoke(CslaConfiguration.Configure());
     return(builder);
 }
 /// <summary>
 /// Add CSLA .NET services for use by the application.
 /// </summary>
 /// <param name="services">ServiceCollection object</param>
 /// <param name="config">Implement to configure CSLA .NET</param>
 public static ICslaBuilder AddCsla(this IServiceCollection services, Action <CslaConfiguration> config)
 {
     services.TryAddScoped <ApplicationContext>();
     services.TryAddScoped(typeof(Core.IContextManager), typeof(Core.ApplicationContextManager));
     services.TryAddTransient(typeof(IDataPortal <>), typeof(DataPortal <>));
     config?.Invoke(CslaConfiguration.Configure());
     return(new CslaBuilder(services));
 }
Esempio n. 5
0
 /// <summary>
 /// Configures the application to use CSLA .NET
 /// </summary>
 /// <param name="app">ApplicationBuilder object</param>
 /// <param name="config">Implement to configure CSLA .NET</param>
 public static IComponentsApplicationBuilder UseCsla(
     this IComponentsApplicationBuilder app, Action <CslaConfiguration> config)
 {
     CslaConfiguration.Configure().
     ContextManager(typeof(Csla.Blazor.ApplicationContextManager));
     config?.Invoke(CslaConfiguration.Configure());
     return(app);
 }
Esempio n. 6
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);
 }
Esempio n. 7
0
 /// <summary>
 /// Configures the application to use CSLA .NET
 /// </summary>
 /// <param name="app">ApplicationBuilder object</param>
 /// <param name="config">Implement to configure CSLA .NET</param>
 public static IApplicationBuilder UseCsla(
     this IApplicationBuilder app, Action <CslaConfiguration> config)
 {
     ApplicationContext.DefaultServiceProvider = app.ApplicationServices;
     ApplicationContext.WebContextManager      =
         new Csla.AspNetCore.ApplicationContextManager(app.ApplicationServices);
     config?.Invoke(CslaConfiguration.Configure());
     return(app);
 }
Esempio n. 8
0
 /// <summary>
 /// Configures the application to use CSLA .NET
 /// </summary>
 /// <param name="builder">IWebAssemblyHostBuilder object</param>
 /// <param name="config">Implement to configure CSLA .NET</param>
 public static WebAssemblyHostBuilder UseCsla(
     this WebAssemblyHostBuilder builder, Action <CslaConfiguration> config)
 {
     builder.Services.AddCsla().WithBlazorClientSupport();
     CslaConfiguration.Configure().
     ContextManager(typeof(Csla.Blazor.ApplicationContextManager));
     config?.Invoke(CslaConfiguration.Configure());
     return(builder);
 }
Esempio n. 9
0
 /// <summary>
 /// Configures the application to use CSLA .NET
 /// </summary>
 /// <param name="builder">IHostBuilder instance</param>
 /// <param name="config">Implement to configure CSLA .NET</param>
 public static IHostBuilder UseCsla(
     this IHostBuilder builder, Action <CslaConfiguration> config)
 {
     builder.ConfigureServices(services =>
     {
         services.TryAddScoped(typeof(Csla.Core.IContextManager), typeof(Csla.Windows.ApplicationContextManager));
     });
     config?.Invoke(CslaConfiguration.Configure());
     return(builder);
 }
Esempio n. 10
0
 /// <summary>
 /// Configures the application to use CSLA .NET
 /// </summary>
 /// <param name="builder">IWebAssemblyHostBuilder object</param>
 /// <param name="config">Implement to configure CSLA .NET</param>
 public static WebAssemblyHostBuilder UseCsla(
     this WebAssemblyHostBuilder builder, Action <CslaConfiguration> config)
 {
     builder.Services.AddCsla();
     builder.Services.AddTransient(typeof(ViewModel <>), typeof(ViewModel <>));
     builder.Services.AddSingleton <IAuthorizationPolicyProvider, CslaPermissionsPolicyProvider>();
     builder.Services.AddSingleton <IAuthorizationHandler, CslaPermissionsHandler>();
     CslaConfiguration.Configure().
     ContextManager(typeof(Csla.Blazor.ApplicationContextManager));
     config?.Invoke(CslaConfiguration.Configure());
     return(builder);
 }
Esempio n. 11
0
 /// <summary>
 /// Configures the application to use CSLA .NET
 /// in a Blazor WebAssembly runtime
 /// </summary>
 /// <param name="builder">IWebAssemblyHostBuilder object</param>
 /// <param name="config">Implement to configure CSLA .NET</param>
 public static WebAssemblyHostBuilder UseCsla(
     this WebAssemblyHostBuilder builder, Action <CslaConfiguration> config)
 {
     builder.Services.AddCsla();
     DataPortalClient.HttpProxy.UseTextSerialization = true;
     builder.Services.TryAddTransient(typeof(ViewModel <>), typeof(ViewModel <>));
     builder.Services.TryAddSingleton <IAuthorizationPolicyProvider, CslaPermissionsPolicyProvider>();
     builder.Services.TryAddSingleton <IAuthorizationHandler, CslaPermissionsHandler>();
     CslaConfiguration.Configure().
     ContextManager(typeof(Csla.Core.ApplicationContextManagerStatic));
     config?.Invoke(CslaConfiguration.Configure());
     return(builder);
 }