forked from MarimerLLC/csla
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MarimerLLC#982 MarimerLLC#1012 Add extension methods for service and …
…config integration in .NET Core
- Loading branch information
1 parent
a169e30
commit 4446709
Showing
4 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
Source/Csla.Shared/Configuration/ConfigurationExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#if NETSTANDARD2_0 | ||
//----------------------------------------------------------------------- | ||
// <copyright file="ConfigurationExtensions.cs" company="Marimer LLC"> | ||
// Copyright (c) Marimer LLC. All rights reserved. | ||
// Website: http://www.lhotka.net/cslanet/ | ||
// </copyright> | ||
// <summary>Implement extension methods for .NET Core configuration</summary> | ||
//----------------------------------------------------------------------- | ||
using Microsoft.Extensions.Configuration; | ||
using Microsoft.Extensions.DependencyInjection; | ||
|
||
namespace Csla.Configuration | ||
{ | ||
/// <summary> | ||
/// Implement extension methods for .NET Core configuration | ||
/// </summary> | ||
public static class ConfigurationExtensions | ||
{ | ||
/// <summary> | ||
/// Add CSLA .NET services for use by the application | ||
/// and enable CSLA .NET configuration. | ||
/// </summary> | ||
/// <param name="services">IServiceCollection object</param> | ||
public static ICslaBuilder AddCsla(this IServiceCollection services) | ||
{ | ||
services.AddScoped<IDataPortalService, DataPortalService>(); | ||
return null; | ||
} | ||
|
||
/// <summary> | ||
/// Configure CSLA .NET settings from .NET Core configuration | ||
/// subsystem. | ||
/// </summary> | ||
/// <param name="config">Configuration root object</param> | ||
public static IConfigurationRoot ConfigureCsla(this IConfigurationRoot config) | ||
{ | ||
config.Bind("csla", new CslaConfigurationOptions()); | ||
return config; | ||
} | ||
} | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
//----------------------------------------------------------------------- | ||
// <copyright file="ICslaBuilder.cs" company="Marimer LLC"> | ||
// Copyright (c) Marimer LLC. All rights reserved. | ||
// Website: http://www.lhotka.net/cslanet/ | ||
// </copyright> | ||
// <summary>Define CSLA .NET service builder</summary> | ||
//----------------------------------------------------------------------- | ||
namespace Csla.Configuration | ||
{ | ||
/// <summary> | ||
/// Define CSLA .NET service builder | ||
/// </summary> | ||
public interface ICslaBuilder | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters