Skip to content

Commit

Permalink
Merge pull request #1163 from rockfordlhotka/1102-dataportal
Browse files Browse the repository at this point in the history
closes #1102
closes #787
closes #1176
closes #1179
  • Loading branch information
rockfordlhotka authored Jul 31, 2019
2 parents 02cad6c + ed95966 commit 8a3c372
Show file tree
Hide file tree
Showing 48 changed files with 2,350 additions and 956 deletions.
43 changes: 43 additions & 0 deletions Samples/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
[*]
end_of_line = crlf
indent_style = space
indent_size = 2

[*.cs]
csharp_new_line_before_catch = true
csharp_new_line_before_else = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_anonymous_types = true
csharp_new_line_before_members_in_object_initializers = false
csharp_new_line_between_query_expression_clauses = true
csharp_prefer_braces = false
csharp_preferred_modifier_order = public,private,protected,internal,static,override,async,virtual,readonly,sealed,abstract,new
csharp_prefer_simple_default_expression = true
csharp_preserve_single_line_blocks = true
csharp_space_after_cast = false
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_between_method_call_parameter_list_parentheses = false
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_style_expression_bodied_accessors = true
csharp_style_expression_bodied_constructors = true
csharp_style_expression_bodied_indexers = true
csharp_style_expression_bodied_methods = true
csharp_style_expression_bodied_operators = true
csharp_style_expression_bodied_properties = true
csharp_style_inlined_variable_declaration = true
csharp_style_pattern_local_over_anonymous_function = true
csharp_style_pattern_matching_over_as_with_null_check = true
csharp_style_var_elsewhere = true
csharp_style_var_for_built_in_types = true
csharp_style_var_when_type_is_apparent = true
dotnet_sort_system_directives_first = true
dotnet_style_object_initializer = true
dotnet_style_predefined_type_for_locals_parameters_members = true
dotnet_style_predefined_type_for_member_access = true
dotnet_style_prefer_inferred_anonymous_type_member_names = false
dotnet_style_prefer_inferred_tuple_names = true
dotnet_style_qualification_for_event = false
dotnet_style_qualification_for_field = false
dotnet_style_qualification_for_method = false
dotnet_style_qualification_for_property = false
dotnet_style_require_accessibility_modifiers = always
4 changes: 2 additions & 2 deletions Source/Csla.Axml.Android/Resources/Resource.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

70 changes: 67 additions & 3 deletions Source/Csla.Shared/ApplicationContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -814,9 +814,33 @@ internal static void SetLogicalExecutionLocation(LogicalExecutionLocations locat
{
LocalContext["__logicalExecutionLocation"] = location;
}
#endregion
#endregion

#region ServiceProvider

/// <summary>
/// Gets or sets the default service provider
/// for this application.
/// </summary>
public static IServiceProvider DefaultServiceProvider
{
get => _contextManager.GetDefaultServiceProvider();
set => _contextManager.SetDefaultServiceProvider(value);
}

/// <summary>
/// Gets or sets the service provider
/// for this application context.
/// </summary>
public static IServiceProvider ScopedServiceProvider
{
get => _contextManager.GetScopedServiceProvider();
set => _contextManager.SetScopedServiceProvider(value);
}

#endregion

#region Default context manager
#region Default context manager

/// <summary>
/// Default context manager for the user property
Expand Down Expand Up @@ -951,8 +975,48 @@ public void SetGlobalContext(ContextDictionary globalContext)
LocalDataStoreSlot slot = Thread.GetNamedDataSlot(_globalContextName);
Thread.SetData(slot, globalContext);
}

private static IServiceProvider _provider;

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

/// <summary>
/// Sets the default IServiceProvider
/// </summary>
/// <param name="serviceProvider">IServiceProvider instance</param>
public void SetDefaultServiceProvider(IServiceProvider serviceProvider)
{
_provider = serviceProvider;
}

/// <summary>
/// Gets the scoped IServiceProvider
/// </summary>
public IServiceProvider GetScopedServiceProvider()
{
IServiceProvider result = null;
result = (IServiceProvider)Csla.ApplicationContext.LocalContext["__ssp"];
if (result == null)
result = GetDefaultServiceProvider();
return result;
}

/// <summary>
/// Sets the scoped IServiceProvider
/// </summary>
/// <param name="serviceProvider">IServiceProvider instance</param>
public void SetScopedServiceProvider(IServiceProvider serviceProvider)
{
Csla.ApplicationContext.LocalContext["__ssp"] = serviceProvider;
}
}

#endregion
#endregion
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
using Csla.Security;
using Csla.Serialization.Mobile;
using System;
using static Csla.ApplicationContext;

namespace Csla.Configuration
{
Expand Down
5 changes: 2 additions & 3 deletions Source/Csla.Shared/Configuration/ConfigurationExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@ namespace Csla.Configuration
public static class ConfigurationExtensions
{
/// <summary>
/// Add CSLA .NET services for use by the application
/// and enable CSLA .NET configuration.
/// Add CSLA .NET services for use by the application.
/// </summary>
/// <param name="services">IServiceCollection object</param>
/// <param name="services">ServiceCollection object</param>
public static ICslaBuilder AddCsla(this IServiceCollection services)
{
services.AddSingleton<IDataPortalFactory, DataPortalFactory>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,14 @@ namespace Csla.Configuration
/// </summary>
public class CslaConfiguration : ICslaConfiguration
{
#if !NETSTANDARD2_0
/// <summary>
/// Gets a configuration instance.
/// </summary>
public static ICslaConfiguration Configure()
{
return new CslaConfiguration();
}

/// <summary>
/// Sets the web context manager.
/// </summary>
Expand All @@ -32,7 +39,6 @@ public ICslaConfiguration WebContextManager(IContextManager contextManager)
ApplicationContext.WebContextManager = contextManager;
return this;
}
#endif

/// <summary>
/// Sets the context manager.
Expand Down Expand Up @@ -115,6 +121,16 @@ public ICslaConfiguration PropertyInfoFactory(string typeName)
return this;
}

/// <summary>
/// Sets the default IServiceProvider for the application.
/// </summary>
/// <param name="serviceProvider">IServiceProvider instance</param>
public ICslaConfiguration DefaultServiceProvider(IServiceProvider serviceProvider)
{
ApplicationContext.DefaultServiceProvider = serviceProvider;
return this;
}

/// <summary>
/// Resets any ApplicationContext settings so they
/// re-read their configuration from AppSettings
Expand Down
22 changes: 22 additions & 0 deletions Source/Csla.Shared/Core/FieldManager/FieldDataManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,17 @@ public List<object> GetChildren()
/// all child objects contained in
/// the list of fields.
/// </summary>
public void UpdateChildren()
{
UpdateChildren(Server.EmptyCriteria.Instance);
}

/// <summary>
/// Invokes the data portal to update
/// all child objects contained in
/// the list of fields.
/// </summary>
/// <param name="parameters">Paramters for method</param>
public void UpdateChildren(params object[] parameters)
{
foreach (var item in _fieldData)
Expand All @@ -655,6 +666,17 @@ public void UpdateChildren(params object[] parameters)
/// all child objects, including those which are not dirty,
/// contained in the list of fields.
/// </summary>
public void UpdateAllChildren()
{
UpdateAllChildren(Server.EmptyCriteria.Instance);
}

/// <summary>
/// Invokes the data portal to update
/// all child objects, including those which are not dirty,
/// contained in the list of fields.
/// </summary>
/// <param name="parameters">Paramters for method</param>
public void UpdateAllChildren(params object[] parameters)
{
Server.ChildDataPortal portal = new Server.ChildDataPortal();
Expand Down
18 changes: 18 additions & 0 deletions Source/Csla.Shared/Core/IContextManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,23 @@ public interface IContextManager
/// </summary>
/// <param name="globalContext">Global context.</param>
void SetGlobalContext(ContextDictionary globalContext);
/// <summary>
/// Gets the default IServiceProvider
/// </summary>
IServiceProvider GetDefaultServiceProvider();
/// <summary>
/// Sets the default IServiceProvider
/// </summary>
/// <param name="serviceProvider">IServiceProvider instance</param>
void SetDefaultServiceProvider(IServiceProvider serviceProvider);
/// <summary>
/// Gets the scoped IServiceProvider
/// </summary>
IServiceProvider GetScopedServiceProvider();
/// <summary>
/// Sets the scoped IServiceProvider
/// </summary>
/// <param name="serviceProvider">IServiceProvider instance</param>
void SetScopedServiceProvider(IServiceProvider serviceProvider);
}
}
27 changes: 15 additions & 12 deletions Source/Csla.Shared/Csla.Shared.projitems
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,21 @@
<Compile Include="$(MSBuildThisFileDirectory)BusinessListBase.cs" />
<Compile Include="$(MSBuildThisFileDirectory)CommandBase.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ComponentModel\BrowsableAttribute.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Configuration\ConfigurationErrorsException.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Configuration\Abstraction\ConfigurationErrorsException.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Configuration\Abstraction\ConfigurationManager.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Configuration\Abstraction\ConnectionStringSettings.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Configuration\Abstraction\ConnectionStringSettingsCollection.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Configuration\Bind\CslaConfigurationOptions.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Configuration\Bind\CslaDataPortalConfigurationOptions.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Configuration\ConfigurationExtensions.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Configuration\ConnectionStringSettingsCollection.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Configuration\ConfigurationManager.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Configuration\ConnectionStringSettings.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Configuration\CslaBuilder.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Configuration\CslaConfiguration.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Configuration\CslaConfigurationOptions.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Configuration\CslaDataConfiguration.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Configuration\CslaDataPortalConfiguration.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Configuration\CslaSecurityConfiguration.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Configuration\CslaSerializationConfiguration.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Configuration\CslaDataPortalConfigurationOptions.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Configuration\Fluent\CslaConfiguration.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Configuration\Fluent\CslaDataConfiguration.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Configuration\Fluent\CslaDataPortalConfiguration.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Configuration\Fluent\CslaSecurityConfiguration.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Configuration\Fluent\CslaSerializationConfiguration.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Configuration\Fluent\ICslaConfiguration.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Configuration\ICslaBuilder.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Configuration\ICslaConfiguration.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Core\AddedNewEventArgs.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Core\AsyncFactoryDelegates.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Core\BindableBase.cs" />
Expand Down Expand Up @@ -129,6 +129,7 @@
<Compile Include="$(MSBuildThisFileDirectory)DataPortalClient\WcfProxy.cs" />
<Compile Include="$(MSBuildThisFileDirectory)DataPortalEventArgs.cs" />
<Compile Include="$(MSBuildThisFileDirectory)DataPortalException.cs" />
<Compile Include="$(MSBuildThisFileDirectory)DataPortalOperationAttributes.cs" />
<Compile Include="$(MSBuildThisFileDirectory)DataPortalOperationExtensions.cs" />
<Compile Include="$(MSBuildThisFileDirectory)DataPortalOperations.cs" />
<Compile Include="$(MSBuildThisFileDirectory)DataPortalResult.cs" />
Expand Down Expand Up @@ -184,6 +185,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Reflection\MethodCacheKey.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Reflection\MethodCaller.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Reflection\Reflect.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Reflection\ServiceProviderMethodCaller.cs" />
<Compile Include="$(MSBuildThisFileDirectory)RelationshipTypes.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Resources.Designer.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Rules\AuthorizationActions.cs" />
Expand Down Expand Up @@ -273,6 +275,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Server\DataPortalMethodInfo.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Server\DataPortalResult.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Server\DataPortalSelector.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Server\DataPortalTarget.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Server\DefaultDataPortalActivator.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Server\EmptyCriteria.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Server\FactoryDataPortal.cs" />
Expand Down
Loading

0 comments on commit 8a3c372

Please sign in to comment.