CSLA .NET 10.0.0
A home for your business logic
Loading...
Searching...
No Matches
Csla.ApplicationContext Class Reference

Provides consistent context information between the client and server DataPortal objects. More...

Public Types

enum  ExecutionLocations { Client , Server }
 Enum representing the locations code can execute. More...
enum  PropertyChangedModes { Windows , Xaml }
 Enum representing the way in which CSLA .NET should raise PropertyChanged events. More...
enum  LogicalExecutionLocations { Client , Server }
 Enum representing the logical execution location The setting is set to server when server is executing a CRUD operation, otherwise the setting is always client. More...

Public Member Functions

 ApplicationContext (ApplicationContextAccessor applicationContextAccessor)
 Creates a new instance of the type.
void Clear ()
 Clears all context collections.
GetRequiredService< T > ()
 Attempts to get service via DI using ServiceProviderServiceExtensions.GetRequiredService. Throws exception if service not properly registered with DI.
object GetRequiredService (Type serviceType)
 Attempts to get service via DI using ServiceProviderServiceExtensions.GetRequiredService. Throws exception if service not properly registered with DI.
CreateInstanceDI<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)]T > (params object[] parameters)
 Creates an object using the IDataPortalActivator.
object CreateInstanceDI ([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)]Type objectType, params object[] parameters)
 Creates an object using the IDataPortalActivator.
CreateInstance<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] T > (params object[] parameters)
 Creates an object using Activator.
object CreateInstance ([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type objectType, params object[] parameters)
 Creates an object using Activator.

Static Public Attributes

const string DefaultRuleSet = "default"
 The default RuleSet name.

Properties

IContextManager ContextManager [get]
 Gets the context manager responsible for storing user and context information for the application.
ClaimsPrincipal Principal [get, set]
 Get or set the current ClaimsPrincipal object representing the user's identity.
IPrincipal User [get, set]
 Get or set the current IPrincipal object representing the user's identity.
IContextDictionary LocalContext [get]
 Returns the application-specific context data that is local to the current AppDomain.
IContextDictionary ClientContext [get]
 Returns the application-specific context data provided by the client.
bool IsOffline [get, set]
 Gets or sets a value indicating whether the app should be considered "offline".
static bool UseReflectionFallback = false [get, set]
 Gets or sets a value indicating whether CSLA should fallback to using reflection instead of System.Linq.Expressions (true, default).
PropertyChangedModes PropertyChangedMode [get]
 Gets or sets a value specifying how CSLA .NET should raise PropertyChanged events.
ExecutionLocations ExecutionLocation [get]
 Returns a value indicating whether the application code is currently executing on the client or server.
string RuleSet [get, set]
 Gets or sets the RuleSet name to use for HasPermission calls.
LogicalExecutionLocations LogicalExecutionLocation [get]
 Return Logical Execution Location - Client or Server This is applicable to Local mode as well.
bool IsAStatefulContextManager [get]
 Gets a value indicating whether the current context manager is used in a stateful context (e.g. WPF, Blazor, etc.).

Detailed Description

Provides consistent context information between the client and server DataPortal objects.

Member Enumeration Documentation

◆ ExecutionLocations

Enum representing the locations code can execute.

Enumerator
Client 

The code is executing on the client.

Server 

The code is executing on the application server.

◆ LogicalExecutionLocations

Enum representing the logical execution location The setting is set to server when server is executing a CRUD operation, otherwise the setting is always client.

Enumerator
Client 

The code is executing on the client.

Server 

The code is executing on the server. This includes Local mode execution.

◆ PropertyChangedModes

Enum representing the way in which CSLA .NET should raise PropertyChanged events.

Enumerator
Windows 

Raise PropertyChanged events as required by Windows Forms data binding.

Xaml 

Raise PropertyChanged events as required by XAML data binding in WPF.

Constructor & Destructor Documentation

◆ ApplicationContext()

Csla.ApplicationContext.ApplicationContext ( ApplicationContextAccessor applicationContextAccessor)
inline

Creates a new instance of the type.

Parameters
applicationContextAccessor

Member Function Documentation

◆ Clear()

void Csla.ApplicationContext.Clear ( )
inline

Clears all context collections.

◆ CreateInstance()

object Csla.ApplicationContext.CreateInstance ( [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type objectType,
params object[] parameters )
inline

Creates an object using Activator.

Parameters
objectTypeType of object to create
parametersParameters for constructor

◆ CreateInstance<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] T >()

T Csla.ApplicationContext.CreateInstance<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] T > ( params object[] parameters)
inline

Creates an object using Activator.

Template Parameters
TType of object to create.
Parameters
parametersParameters for constructor

◆ CreateInstanceDI()

object Csla.ApplicationContext.CreateInstanceDI ( [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type objectType,
params object[] parameters )
inline

Creates an object using the IDataPortalActivator.

Parameters
objectTypeType of object to create
parametersManually passed in parameters for constructor

◆ CreateInstanceDI<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)]T >()

T Csla.ApplicationContext.CreateInstanceDI<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)]T > ( params object[] parameters)
inline

Creates an object using the IDataPortalActivator.

Template Parameters
TType of object to create.
Parameters
parametersParameters for constructor

◆ GetRequiredService()

object Csla.ApplicationContext.GetRequiredService ( Type serviceType)
inline

Attempts to get service via DI using ServiceProviderServiceExtensions.GetRequiredService. Throws exception if service not properly registered with DI.

Parameters
serviceTypeType of service/object to create.

◆ GetRequiredService< T >()

Attempts to get service via DI using ServiceProviderServiceExtensions.GetRequiredService. Throws exception if service not properly registered with DI.

Template Parameters
TType of service/object to create.
Type Constraints
T :notnull 

Member Data Documentation

◆ DefaultRuleSet

const string Csla.ApplicationContext.DefaultRuleSet = "default"
static

The default RuleSet name.

Property Documentation

◆ ClientContext

IContextDictionary Csla.ApplicationContext.ClientContext
get

Returns the application-specific context data provided by the client.

The return value is a HybridDictionary. If one does not already exist, and empty one is created and returned.

Note that data in this context is transferred from the client to the server. No data is transferred from the server to the client.

This property is thread safe in a Windows client setting and on an application server. It is not guaranteed to be thread safe within the context of an ASP.NET client setting (i.e. in your ASP.NET UI).

◆ ContextManager

IContextManager Csla.ApplicationContext.ContextManager
get

Gets the context manager responsible for storing user and context information for the application.

◆ ExecutionLocation

ExecutionLocations Csla.ApplicationContext.ExecutionLocation
get
Initial value:
=
ExecutionLocations
Enum representing the locations code can execute.
Definition ApplicationContext.cs:191

Returns a value indicating whether the application code is currently executing on the client or server.

◆ IsAStatefulContextManager

bool Csla.ApplicationContext.IsAStatefulContextManager
get

Gets a value indicating whether the current context manager is used in a stateful context (e.g. WPF, Blazor, etc.).

◆ IsOffline

bool Csla.ApplicationContext.IsOffline
getset

Gets or sets a value indicating whether the app should be considered "offline".

If this value is true then the client-side data portal will direct all calls to the local data portal. No calls will flow to remote data portal endpoints.

◆ LocalContext

IContextDictionary Csla.ApplicationContext.LocalContext
get

Returns the application-specific context data that is local to the current AppDomain.

The return value is a HybridDictionary. If one does not already exist, and empty one is created and returned.

Note that data in this context is NOT transferred to and from the client and server.

◆ LogicalExecutionLocation

LogicalExecutionLocations Csla.ApplicationContext.LogicalExecutionLocation
get

Return Logical Execution Location - Client or Server This is applicable to Local mode as well.

◆ Principal

ClaimsPrincipal Csla.ApplicationContext.Principal
getset

Get or set the current ClaimsPrincipal object representing the user's identity.

◆ PropertyChangedMode

PropertyChangedModes Csla.ApplicationContext.PropertyChangedMode
get

Gets or sets a value specifying how CSLA .NET should raise PropertyChanged events.

◆ RuleSet

string Csla.ApplicationContext.RuleSet
getset

Gets or sets the RuleSet name to use for HasPermission calls.

The rule set.

◆ User

IPrincipal Csla.ApplicationContext.User
getset

Get or set the current IPrincipal object representing the user's identity.

This is discussed in Chapter 5. When running under IIS the HttpContext.Current.User value is used, otherwise the current Thread.CurrentPrincipal value is used.

◆ UseReflectionFallback

bool Csla.ApplicationContext.UseReflectionFallback = false
staticgetset

Gets or sets a value indicating whether CSLA should fallback to using reflection instead of System.Linq.Expressions (true, default).


The documentation for this class was generated from the following file: