-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(#216) Replace Config Action with extension method
The configuration action does not add any value to the client and arguably makes things more difficult to follow as there are two ways to set client configuration.
- Loading branch information
1 parent
0156281
commit 4306167
Showing
7 changed files
with
30 additions
and
37 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
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
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
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,20 @@ | ||
using System; | ||
using System.Linq; | ||
using Microsoft.Extensions.Configuration; | ||
using RawRabbit.Configuration; | ||
|
||
namespace RawRabbit.vNext | ||
{ | ||
public static class ConfigurationExtension | ||
{ | ||
public static RawRabbitConfiguration ForRawRabbit(this IConfiguration config, string sectionName = "RawRabbit") | ||
{ | ||
var section = config.GetSection(sectionName); | ||
if (!section.GetChildren().Any()) | ||
{ | ||
throw new ArgumentException($"Unable to configuration section '{sectionName}'. Make sure it exists in the provided configuration"); | ||
} | ||
return section.Get<RawRabbitConfiguration>(); | ||
} | ||
} | ||
} |
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
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 |
---|---|---|
@@ -1,13 +1,10 @@ | ||
using System; | ||
using Microsoft.Extensions.Configuration; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using RawRabbit.DependecyInjection; | ||
|
||
namespace RawRabbit.vNext.Pipe | ||
{ | ||
public class RawRabbitOptions : Instantiation.RawRabbitOptions | ||
{ | ||
public new Action<IServiceCollection> DependencyInjection { get; set; } | ||
public Action<IConfigurationBuilder> Configuration { get; set; } | ||
} | ||
} |
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