forked from nacos-group/nacos-sdk-csharp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
17a7dad
commit 8c8e587
Showing
11 changed files
with
158 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
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,21 @@ | ||
# nacos-sdk-csharp.IniParser | ||
|
||
nacos-sdk-csharp.IniParser provides ini format config parser. | ||
|
||
```csharp | ||
builder.Host.UseNacosConfig(section: "NacosConfig", parser: Nacos.IniParser.IniConfigurationStringParser.Instance); | ||
|
||
// or | ||
builder.Host.ConfigureAppConfiguration((c, b) => | ||
{ | ||
var config = b.Build(); | ||
|
||
b.AddNacosV2Configuration(config.GetSection("NacosConfig"), parser: Nacos.IniParser.IniConfigurationStringParser.Instance); | ||
}); | ||
``` | ||
|
||
## Links | ||
|
||
* [Documentation](https://nacos-sdk-csharp.readthedocs.io/en/latest/) | ||
* [nacos-sdk-csharp GitHub](https://github.com/nacos-group/nacos-sdk-csharp) |
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,21 @@ | ||
# nacos-sdk-csharp.YamlParser | ||
|
||
nacos-sdk-csharp.YamlParser provides yaml/yml format config parser. | ||
|
||
```csharp | ||
builder.Host.UseNacosConfig(section: "NacosConfig", parser: Nacos.YamlParser.YamlConfigurationStringParser.Instance); | ||
|
||
// or | ||
builder.Host.ConfigureAppConfiguration((c, b) => | ||
{ | ||
var config = b.Build(); | ||
|
||
b.AddNacosV2Configuration(config.GetSection("NacosConfig"), parser: Nacos.YamlParser.YamlConfigurationStringParser.Instance); | ||
}); | ||
``` | ||
|
||
## Links | ||
|
||
* [Documentation](https://nacos-sdk-csharp.readthedocs.io/en/latest/) | ||
* [nacos-sdk-csharp GitHub](https://github.com/nacos-group/nacos-sdk-csharp) |
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,31 @@ | ||
# nacos-sdk-csharp.AspNetCore | ||
|
||
nacos-sdk-csharp.AspNetCore provides service registration and discovery With ASP.NET Core. | ||
|
||
```csharp | ||
builder.Services.AddNacosAspNet(x => | ||
{ | ||
x.ServerAddresses = new List<string> { "http://localhost:8848/" }; | ||
x.Namespace = "cs"; | ||
x.ServiceName = "App2"; | ||
x.GroupName = "DEFAULT_GROUP"; | ||
x.ClusterName = "DEFAULT"; | ||
x.Ip = ""; | ||
x.PreferredNetworks = ""; | ||
x.Port = 0; | ||
x.Weight = 100; | ||
x.RegisterEnabled = true; | ||
x.InstanceEnabled = true; | ||
x.Ephemeral = true; | ||
x.Secure = false; | ||
}); | ||
|
||
// or | ||
builder.Services.AddNacosAspNet(builder.Configuration); | ||
``` | ||
|
||
## Links | ||
|
||
* [Documentation](https://nacos-sdk-csharp.readthedocs.io/en/latest/) | ||
* [nacos-sdk-csharp GitHub](https://github.com/nacos-group/nacos-sdk-csharp) |
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,28 @@ | ||
# nacos-sdk-csharp.Extensions.Configuration | ||
|
||
nacos-sdk-csharp.Extensions.Configuration provides integration with ASP.NET Core Configuration System. | ||
|
||
```csharp | ||
builder.Host.UseNacosConfig(section: "NacosConfig"); | ||
|
||
// or | ||
builder.Host.ConfigureAppConfiguration((c, b) => | ||
{ | ||
var config = b.Build(); | ||
|
||
// read configuration from config files | ||
// default is json | ||
// b.AddNacosV2Configuration(config.GetSection("NacosConfig")); | ||
b.AddNacosV2Configuration(config.GetSection("NacosConfig")); | ||
|
||
// specify ini or yaml | ||
b.AddNacosV2Configuration(config.GetSection("NacosConfig"), parser: Nacos.IniParser.IniConfigurationStringParser.Instance); | ||
b.AddNacosV2Configuration(config.GetSection("NacosConfig"), parser: Nacos.YamlParser.YamlConfigurationStringParser.Instance); | ||
}); | ||
``` | ||
|
||
## Links | ||
|
||
* [Documentation](https://nacos-sdk-csharp.readthedocs.io/en/latest/) | ||
* [nacos-sdk-csharp GitHub](https://github.com/nacos-group/nacos-sdk-csharp) |
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,45 @@ | ||
# nacos-sdk-csharp | ||
|
||
nacos-sdk-csharp provides basic nacos operation. | ||
|
||
```csharp | ||
// config | ||
builder.Services.AddNacosV2Config(x => | ||
{ | ||
x.ServerAddresses = new List<string> { "http://localhost:8848/" }; | ||
x.Namespace = "cs"; | ||
x.UserName = "nacos"; | ||
x.Password = "nacos"; | ||
}); | ||
|
||
// naming | ||
builder.Services.AddNacosV2Naming(x => | ||
{ | ||
x.ServerAddresses = new List<string> { "http://localhost:8848/" }; | ||
x.Namespace = "cs"; | ||
x.UserName = "nacos"; | ||
x.Password = "nacos"; | ||
}); | ||
|
||
// or | ||
builder.Services.AddNacosV2Config(builder.Configuration); | ||
|
||
builder.Services.AddNacosV2Naming(builder.Configuration); | ||
``` | ||
|
||
```csharp | ||
private readonly INacosConfigService _config; | ||
private readonly INacosNamingService _naming; | ||
|
||
public TheCtor(INacosConfigService config, INacosNamingService naming) | ||
{ | ||
_config = config; | ||
_naming = naming; | ||
} | ||
``` | ||
|
||
## Links | ||
|
||
* [Documentation](https://nacos-sdk-csharp.readthedocs.io/en/latest/) | ||
* [nacos-sdk-csharp GitHub](https://github.com/nacos-group/nacos-sdk-csharp) |