Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
HenriqueCaires authored Nov 26, 2018
1 parent 9e01fa8 commit 17cdd32
Showing 1 changed file with 14 additions and 18 deletions.
32 changes: 14 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ Instantiate the context and the service that you want and call the operation:
```csharp
using(var context = new Context(url, user, password))
{
var service = new HostService(context);
var host = service.GetByName("myHost");
var host = context.Hosts.GetByName("myHost");
}
```

Expand All @@ -32,8 +31,7 @@ You can make your own query too, like that:
```csharp
using(var context = new Context(url, user, password))
{
var service = new HostService(context);
var host = service.Get(new {
var host = context.Hosts.Get(new {
name = "myHost"
});
}
Expand All @@ -44,26 +42,26 @@ Or that:
```csharp
using (var context = new Context(url, user, password))
{
var service = new HostService(context);
var host2 = service.Get(new
var host2 = context.Hosts.Get(new
{
hostid = "1"
});
}
```

## Configuring via the `.config` file
## Configuring via the `appsettings.json` file

Instead of specifying the configuration in the constructor the `.config` file can be used like that:
Instead of specifying the configuration in the constructor the `appsettings.json` file can be used like that:

```json
{
"ZabbixApi": {
"url": "http://MyZabbixServer/zabbix/api_jsonrpc.php",
"user": "Admin",
"password": "zabbix"
}
}

```xml
<configuration>
<appSettings>
<add key="ZabbixApi.url" value="http://myZabbixServer/zabbix/api_jsonrpc.php" />
<add key="ZabbixApi.user" value="Admin" />
<add key="ZabbixApi.password" value="zabbix" />
</appSettings>
</configuration>
```

The empty constructor can then be used:
Expand All @@ -74,5 +72,3 @@ using(var context = new Context())
// ...
}
```

⚠️ *Only available on the Full .Net Framework, the .Net Standard version of the library doesn't have this constructor.*

0 comments on commit 17cdd32

Please sign in to comment.