Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ public TestableDataPortal(
CslaOptions options,
IAuthorizeDataPortal authorizer,
InterceptorManager interceptors,
IObjectFactoryLoader factoryLoader,
IDataPortalActivator activator,
IDataPortalExceptionInspector exceptionInspector,
DataPortalExceptionHandler exceptionHandler,
SecurityOptions securityOptions
) : base(
Expand All @@ -35,9 +32,6 @@ SecurityOptions securityOptions
options,
authorizer,
interceptors,
factoryLoader,
activator,
exceptionInspector,
exceptionHandler,
securityOptions
)
Expand Down
29 changes: 15 additions & 14 deletions Source/Csla/Configuration/Fluent/DataOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,54 +19,55 @@ public class DataOptions
/// <summary>
/// Sets the default transaction isolation level.
/// </summary>
public TransactionIsolationLevel DefaultTransactionIsolationLevel
public TransactionIsolationLevel DefaultTransactionIsolationLevel
{
get => defaultTransactionIsolationLevel;
set => defaultTransactionIsolationLevel = value;
get => _defaultTransactionIsolationLevel;
set => _defaultTransactionIsolationLevel = value;
}

/// <summary>
/// Sets the default transaction timeout in seconds.
/// </summary>
public int DefaultTransactionTimeoutInSeconds
{
get => defaultTransactionTimeoutInSeconds;
set => defaultTransactionTimeoutInSeconds = value;
get => _defaultTransactionTimeoutInSeconds;
set => _defaultTransactionTimeoutInSeconds = value;
}

/// <summary>
/// Sets the default transaction async flow option
/// used to create new TransactionScope objects.
/// </summary>
public TransactionScopeAsyncFlowOption DefaultTransactionAsyncFlowOption {
get => defaultTransactionScopeAsyncFlowOption;
set => defaultTransactionScopeAsyncFlowOption = value;
public TransactionScopeAsyncFlowOption DefaultTransactionAsyncFlowOption
{
get => _defaultTransactionScopeAsyncFlowOption;
set => _defaultTransactionScopeAsyncFlowOption = value;
}

private static TransactionIsolationLevel defaultTransactionIsolationLevel = TransactionIsolationLevel.Unspecified;
private static int defaultTransactionTimeoutInSeconds = 30;
private static TransactionScopeAsyncFlowOption defaultTransactionScopeAsyncFlowOption = TransactionScopeAsyncFlowOption.Suppress;
private static TransactionIsolationLevel _defaultTransactionIsolationLevel = TransactionIsolationLevel.Unspecified;
private static int _defaultTransactionTimeoutInSeconds = 30;
private static TransactionScopeAsyncFlowOption _defaultTransactionScopeAsyncFlowOption = TransactionScopeAsyncFlowOption.Suppress;

/// <summary>
/// Gets the default transaction isolation level.
/// </summary>
/// <value>
/// The default transaction isolation level.
/// </value>
internal static TransactionIsolationLevel GetDefaultTransactionIsolationLevel() => defaultTransactionIsolationLevel;
internal static TransactionIsolationLevel GetDefaultTransactionIsolationLevel() => _defaultTransactionIsolationLevel;

/// <summary>
/// Gets default transaction timeout in seconds.
/// </summary>
/// <value>
/// The default transaction timeout in seconds.
/// </value>
internal static int GetDefaultTransactionTimeoutInSeconds() => defaultTransactionTimeoutInSeconds;
internal static int GetDefaultTransactionTimeoutInSeconds() => _defaultTransactionTimeoutInSeconds;

/// <summary>
/// Gets the default transaction scope async flow option.
/// </summary>
/// <returns>The default transaction scope async flow option.</returns>
internal static TransactionScopeAsyncFlowOption GetDefaultTransactionScopeAsyncFlowOption() => defaultTransactionScopeAsyncFlowOption;
internal static TransactionScopeAsyncFlowOption GetDefaultTransactionScopeAsyncFlowOption() => _defaultTransactionScopeAsyncFlowOption;
}
}
32 changes: 16 additions & 16 deletions Source/Csla/Core/ApplicationContextManagerStatic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
// <summary>Default context manager for the user property</summary>
//-----------------------------------------------------------------------

using System.Security.Principal;
using System.Security.Claims;
using System.Security.Principal;

namespace Csla.Core
{
Expand All @@ -30,35 +30,35 @@ public class ApplicationContextManagerStatic : IContextManager
/// </summary>
public bool IsValid => true;

private static IContextDictionary? currentLocalContext = new ContextDictionary();
private static IContextDictionary? currentClientContext = new ContextDictionary();
private static IPrincipal currentPrincipal = new ClaimsPrincipal();
private static IServiceProvider? currentDefaultServiceProvider;
private static IServiceProvider? currentServiceProvider;
private static IContextDictionary? _currentLocalContext = new ContextDictionary();
private static IContextDictionary? _currentClientContext = new ContextDictionary();
private static IPrincipal _currentPrincipal = new ClaimsPrincipal();
private static IServiceProvider? _currentDefaultServiceProvider;
private static IServiceProvider? _currentServiceProvider;

/// <summary>
/// Gets the client context dictionary.
/// </summary>
/// <param name="executionLocation"></param>
public IContextDictionary? GetClientContext(ApplicationContext.ExecutionLocations executionLocation)
{
return currentClientContext;
return _currentClientContext;
}

/// <summary>
/// Gets the default IServiceProvider
/// </summary>
public IServiceProvider? GetDefaultServiceProvider()
{
return currentDefaultServiceProvider;
return _currentDefaultServiceProvider;
}

/// <summary>
/// Gets the local context dictionary.
/// </summary>
public IContextDictionary? GetLocalContext()
{
return currentLocalContext;
return _currentLocalContext;
}

/// <summary>
Expand All @@ -67,7 +67,7 @@ public class ApplicationContextManagerStatic : IContextManager
/// <returns>The current user principal</returns>
public IPrincipal GetUser()
{
return currentPrincipal;
return _currentPrincipal;
}

/// <summary>
Expand All @@ -77,7 +77,7 @@ public IPrincipal GetUser()
/// <param name="executionLocation"></param>
public void SetClientContext(IContextDictionary? clientContext, ApplicationContext.ExecutionLocations executionLocation)
{
currentClientContext = clientContext;
_currentClientContext = clientContext;
}

/// <summary>
Expand All @@ -87,7 +87,7 @@ public void SetClientContext(IContextDictionary? clientContext, ApplicationConte
/// <exception cref="ArgumentNullException"><paramref name="serviceProvider"/> is <see langword="null"/>.</exception>
public void SetDefaultServiceProvider(IServiceProvider serviceProvider)
{
currentDefaultServiceProvider = serviceProvider ?? throw new ArgumentNullException(nameof(serviceProvider));
_currentDefaultServiceProvider = serviceProvider ?? throw new ArgumentNullException(nameof(serviceProvider));
}

/// <summary>
Expand All @@ -96,15 +96,15 @@ public void SetDefaultServiceProvider(IServiceProvider serviceProvider)
/// <param name="localContext">Context dictionary</param>
public void SetLocalContext(IContextDictionary? localContext)
{
currentLocalContext = localContext;
_currentLocalContext = localContext;
}

/// <summary>
/// Gets the service provider for current scope
/// </summary>
public IServiceProvider? GetServiceProvider()
{
return currentServiceProvider ?? GetDefaultServiceProvider();
return _currentServiceProvider ?? GetDefaultServiceProvider();
}

/// <summary>
Expand All @@ -114,13 +114,13 @@ public void SetLocalContext(IContextDictionary? localContext)
/// <exception cref="ArgumentNullException"><paramref name="scope"/> is <see langword="null"/>.</exception>
public void SetServiceProvider(IServiceProvider scope)
{
currentServiceProvider = scope ?? throw new ArgumentNullException(nameof(scope));
_currentServiceProvider = scope ?? throw new ArgumentNullException(nameof(scope));
}

/// <inheritdoc />
public void SetUser(IPrincipal principal)
{
currentPrincipal = principal ?? throw new ArgumentNullException(nameof(principal));
_currentPrincipal = principal ?? throw new ArgumentNullException(nameof(principal));
}

private static ApplicationContext? _applicationContext;
Expand Down
6 changes: 3 additions & 3 deletions Source/Csla/Core/InvalidQueryExpression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ namespace Csla.Core
{
class InvalidQueryException : Exception
{
private string message;
private string _message;

public InvalidQueryException(string message)
{
this.message = message + " ";
this._message = message + " ";
}

public override string Message => Resources.ClientQueryIsInvalid + message;
public override string Message => Resources.ClientQueryIsInvalid + _message;
}
}
22 changes: 11 additions & 11 deletions Source/Csla/DataPortalClient/LocalProxy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ namespace Csla.Channels.Local
/// </summary>
public class LocalProxy : DataPortalProxy
{
private readonly LocalProxyOptions _options;

/// <summary>
/// Creates an instance of the type
/// </summary>
Expand All @@ -31,7 +33,7 @@ public class LocalProxy : DataPortalProxy
public LocalProxy(ApplicationContext applicationContext, LocalProxyOptions options)
: base(applicationContext)
{
Options = options;
_options = options;
}

/// <summary>
Expand All @@ -40,13 +42,11 @@ public LocalProxy(ApplicationContext applicationContext, LocalProxyOptions optio
/// </summary>
protected ApplicationContext CallerApplicationContext => ApplicationContext;

private readonly LocalProxyOptions Options;

private void InitializeContext(out IDataPortalServer _portal, out IServiceScope? _logicalServerScope, out ApplicationContext _logicalServerApplicationContext)
{
var logicalServerServiceProvider = CallerApplicationContext.CurrentServiceProvider;

if (Options.UseLocalScope
if (_options.UseLocalScope
&& CallerApplicationContext.LogicalExecutionLocation == ApplicationContext.LogicalExecutionLocations.Client
&& CallerApplicationContext.IsAStatefulContextManager)
{
Expand All @@ -73,7 +73,7 @@ private void SetApplicationContext(object? obj, ApplicationContext applicationCo
{
// if there's no isolated scope, there's no reason to
// change the object graph's ApplicationContext
if (!Options.UseLocalScope)
if (!_options.UseLocalScope)
return;

if (obj is IUseApplicationContext useApplicationContext)
Expand All @@ -84,7 +84,7 @@ private void SetApplicationContext(IUseApplicationContext? obj, ApplicationConte
{
// if there's no isolated scope, there's no reason to
// change the object graph's ApplicationContext
if (!Options.UseLocalScope)
if (!_options.UseLocalScope)
return;

if (obj != null && !ReferenceEquals(obj.ApplicationContext, applicationContext))
Expand Down Expand Up @@ -147,7 +147,7 @@ private void SetApplicationContext(IUseApplicationContext? obj, ApplicationConte
/// </summary>
private void ResetApplicationContext(ApplicationContext logicalServerApplicationContext)
{
if (Options.UseLocalScope)
if (_options.UseLocalScope)
{
if (logicalServerApplicationContext.LogicalExecutionLocation == ApplicationContext.LogicalExecutionLocations.Client)
{
Expand Down Expand Up @@ -185,7 +185,7 @@ public override async Task<DataPortalResult> Create([DynamicallyAccessedMembers(
}
else
{
if (!Options.FlowSynchronizationContext || SynchronizationContext.Current == null)
if (!_options.FlowSynchronizationContext || SynchronizationContext.Current == null)
result = await Task.Run(() => _portal.Create(objectType, criteria, context, isSync));
else
result = await await Task.Factory.StartNew(() => _portal.Create(objectType, criteria, context, isSync),
Expand Down Expand Up @@ -229,7 +229,7 @@ public override async Task<DataPortalResult> Fetch([DynamicallyAccessedMembers(D
}
else
{
if (!Options.FlowSynchronizationContext || SynchronizationContext.Current == null)
if (!_options.FlowSynchronizationContext || SynchronizationContext.Current == null)
result = await Task.Run(() => _portal.Fetch(objectType, criteria, context, isSync));
else
result = await await Task.Factory.StartNew(() => _portal.Fetch(objectType, criteria, context, isSync),
Expand Down Expand Up @@ -273,7 +273,7 @@ public override async Task<DataPortalResult> Update(object obj, DataPortalContex
}
else
{
if (!Options.FlowSynchronizationContext || SynchronizationContext.Current == null)
if (!_options.FlowSynchronizationContext || SynchronizationContext.Current == null)
result = await Task.Run(() => _portal.Update(obj, context, isSync));
else
result = await await Task.Factory.StartNew(() => _portal.Update(obj, context, isSync),
Expand Down Expand Up @@ -317,7 +317,7 @@ public override async Task<DataPortalResult> Delete([DynamicallyAccessedMembers(
}
else
{
if (!Options.FlowSynchronizationContext || SynchronizationContext.Current == null)
if (!_options.FlowSynchronizationContext || SynchronizationContext.Current == null)
result = await Task.Run(() => _portal.Delete(objectType, criteria, context, isSync));
else
result = await await Task.Factory.StartNew(() => _portal.Delete(objectType, criteria, context, isSync),
Expand Down
Loading
Loading