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.Windows/ApplicationContextManager.cs
Go to the documentation of this file.
1//-----------------------------------------------------------------------
2// <copyright file="ApplicationContextManager.cs" company="Marimer LLC">
3// Copyright (c) Marimer LLC. All rights reserved.
4// Website: https://cslanet.com
5// </copyright>
6// <summary>Provides consistent context information between the client</summary>
7//-----------------------------------------------------------------------
8using System;
9using System.Security.Principal;
10using System.Threading;
11using Csla.Core;
12
13namespace Csla.Windows
14{
19 {
24 { }
25
26 private static IPrincipal _principal;
27
32 public override IPrincipal GetUser()
33 {
34 if (_principal == null)
35 {
37 SetUser(new System.Security.Claims.ClaimsPrincipal());
38 else
39#pragma warning disable CA1416 // Validate platform compatibility
40 SetUser(new WindowsPrincipal(WindowsIdentity.GetCurrent()));
41#pragma warning restore CA1416 // Validate platform compatibility
42 }
43 return _principal;
44 }
45
50 public override void SetUser(IPrincipal principal)
51 {
52 _principal = principal;
53 Thread.CurrentPrincipal = principal;
54 }
55 }
56}
Provides consistent context information between the client and server DataPortal objects.
static string AuthenticationType
Gets the authentication type being used by the CSLA .NET framework.
ApplicationContextManager for Windows Forms applications
override IPrincipal GetUser()
Gets the current principal.
override void SetUser(IPrincipal principal)
Sets the current principal.