CSLA.NET 6.0.0
CSLA .NET is a software development framework that helps you build a reusable, maintainable object-oriented business layer for your app.
Csla.AspNetCore/ConfigurationExtensions.cs
Go to the documentation of this file.
1//-----------------------------------------------------------------------
2// <copyright file="AspNetCoreConfigurationExtensions.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 AspNet configuration</summary>
7//-----------------------------------------------------------------------
8using System;
9using Csla.Runtime;
10#if NET5_0_OR_GREATER
11using Csla.AspNetCore.Blazor;
12using Microsoft.AspNetCore.Components.Server.Circuits;
13#endif
16using Csla.Core;
17using Csla.AspNetCore;
18
20{
24 public static class AspNetCoreConfigurationExtensions
25 {
31 public static CslaOptions AddAspNetCore(this CslaOptions config)
32 {
33 return AddAspNetCore(config, null);
34 }
35
42 public static CslaOptions AddAspNetCore(this CslaOptions config, Action<AspNetCoreConfigurationOptions> options)
43 {
44 var localOptions = new AspNetCoreConfigurationOptions();
45 options?.Invoke(localOptions);
46#if NET5_0_OR_GREATER
47 config.Services.AddScoped<ActiveCircuitState>();
48 config.Services.AddScoped(typeof(CircuitHandler), typeof(ActiveCircuitHandler));
49#endif
50 config.Services.AddScoped(typeof(IContextManager), typeof(ApplicationContextManagerHttpContext));
51 return config;
52 }
53 }
54
60 {
65 public bool UseCslaPermissionsPolicy { get; set; } = true;
66 }
67}
Application context manager that uses HttpContextAccessor when resolving HttpContext to store context...
Options that can be provided to the AddAspNetCore method.
bool UseCslaPermissionsPolicy
Indicates whether the app should be configured to use CSLA permissions policies (default = true).
Use this type to configure the settings for CSLA .NET.
Definition: CslaOptions.cs:18
IServiceCollection Services
Gets the current service collection.
Definition: CslaOptions.cs:22
Defines the interface for an application context manager type.