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.
CslaConfiguration.cs
Go to the documentation of this file.
1//-----------------------------------------------------------------------
2// <copyright file="CslaConfiguration.cs" company="Marimer LLC">
3// Copyright (c) Marimer LLC. All rights reserved.
4// Website: https://cslanet.com
5// </copyright>
6// <summary>Use this type to configure the settings for CSLA .NET</summary>
7//-----------------------------------------------------------------------
8using Csla.Core;
9using System;
10
11namespace Csla.Configuration
12{
16 public static class CslaConfigurationExtension
17 {
21 public static CslaConfiguration Configure(this ICslaConfiguration config)
22 {
23 return new CslaConfiguration();
24 }
25 }
26
31 {
36 {
37 return new CslaConfiguration();
38 }
39
40#if !NETSTANDARD2_0 && !NET5_0
51 {
52 ApplicationContext.WebContextManager = contextManager;
53 return this;
54 }
55#endif
56
66 {
67 ApplicationContext.ContextManager = contextManager;
68 return this;
69 }
70
79 public CslaConfiguration ContextManager(Type contextManagerType)
80 {
81 ContextManager((IContextManager)Reflection.MethodCaller.CreateInstance(contextManagerType));
82 return this;
83 }
84
92 {
93 ApplicationContext.UseReflectionFallback = value;
94 return this;
95 }
96
102 public CslaConfiguration PropertyChangedMode(ApplicationContext.PropertyChangedModes mode)
103 {
104 ConfigurationManager.AppSettings["CslaPropertyChangedMode"] = mode.ToString();
105 return this;
106 }
107
124 {
125 if (!string.IsNullOrWhiteSpace(version))
126 if (version.Contains("-") || version.Contains("/"))
127 throw new ArgumentException("VersionRoutingTag");
128 ConfigurationManager.AppSettings["CslaVersionRoutingTag"] = version;
129 return this;
130 }
131
136 public CslaConfiguration RuleSet(string ruleSet)
137 {
138 ApplicationContext.RuleSet = ruleSet;
139 return this;
140 }
141
147 {
148 ConfigurationManager.AppSettings["CslaPropertyInfoFactory"] = typeName;
149 return this;
150 }
151
156#pragma warning disable CS3001 // Argument type is not CLS-compliant
157 public CslaConfiguration DefaultServiceProvider(IServiceProvider defaultServiceProvider)
158#pragma warning restore CS3001 // Argument type is not CLS-compliant
159 {
160 ApplicationContext.DefaultServiceProvider = defaultServiceProvider;
161 return this;
162 }
163
169 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
171 {
172 ApplicationContext.SettingsChanged();
173 return this;
174 }
175 }
176}
Use this type to configure the settings for CSLA .NET.
CslaConfiguration SettingsChanged()
Resets any ApplicationContext settings so they re-read their configuration from AppSettings on next u...
CslaConfiguration ContextManager(Type contextManagerType)
Sets the context manager type.
CslaConfiguration VersionRoutingTag(string version)
Sets a value representing the application version for use in server-side data portal routing.
CslaConfiguration UseReflectionFallback(bool value)
Sets a value indicating whether CSLA should fallback to using reflection instead of System....
CslaConfiguration ContextManager(IContextManager contextManager)
Sets the context manager.
CslaConfiguration PropertyChangedMode(ApplicationContext.PropertyChangedModes mode)
Sets a value specifying how CSLA .NET should raise PropertyChanged events.
CslaConfiguration DefaultServiceProvider(IServiceProvider defaultServiceProvider)
Sets the default service provider which Csla will use.
CslaConfiguration RuleSet(string ruleSet)
Sets the RuleSet name to use for static HasPermission calls.
CslaConfiguration WebContextManager(IContextManager contextManager)
Sets the web context manager.
CslaConfiguration PropertyInfoFactory(string typeName)
Sets the factory type that creates PropertyInfo objects.
static CslaConfiguration Configure()
Gets an instance of the configuration root type.
Use this type to configure the settings for CSLA .NET.
Defines the interface for an application context manager type.