CSLA.NET 5.4.2
CSLA .NET is a software development framework that helps you build a reusable, maintainable object-oriented business layer for your app.
Csla.Blazor.WebAssembly/ConfigurationExtensions.cs
Go to the documentation of this file.
1//-----------------------------------------------------------------------
2// <copyright file="BlazorWasmConfigurationExtensions.cs" company="Marimer LLC">
3// Copyright (c) Marimer LLC. All rights reserved.
4// Website: https://cslanet.com
5// </copyright>
6// <summary>Implement extension methods for .NET Core configuration</summary>
7//-----------------------------------------------------------------------
8using System;
9using Csla.Blazor;
10using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
11using Microsoft.AspNetCore.Authorization;
12using Microsoft.Extensions.DependencyInjection.Extensions;
13
15{
19 public static class BlazorWasmConfigurationExtensions
20 {
25 public static WebAssemblyHostBuilder UseCsla(this WebAssemblyHostBuilder builder)
26 {
27 return UseCsla(builder, null);
28 }
29
36 public static WebAssemblyHostBuilder UseCsla(
37 this WebAssemblyHostBuilder builder, Action<CslaConfiguration> config)
38 {
39 builder.Services.AddCsla();
40 DataPortalClient.HttpProxy.UseTextSerialization = true;
41 builder.Services.TryAddTransient(typeof(ViewModel<>), typeof(ViewModel<>));
42 builder.Services.TryAddSingleton<IAuthorizationPolicyProvider, CslaPermissionsPolicyProvider>();
43 builder.Services.TryAddSingleton<IAuthorizationHandler, CslaPermissionsHandler>();
45 ContextManager(typeof(Csla.Core.ApplicationContextManagerStatic));
46 config?.Invoke(CslaConfiguration.Configure());
47 return builder;
48 }
49 }
50}
Authorization handler for CSLA permissions.
Base type for creating your own viewmodel.
Use this type to configure the settings for CSLA .NET.
static CslaConfiguration Configure()
Gets an instance of the configuration root type.
Context manager for the user property and local/client/global context dictionaries that uses static f...