Skip to content

Commit

Permalink
Update Connectors documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
bart-vmware committed Oct 7, 2024
1 parent f04945b commit fc96828
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 58 deletions.
12 changes: 6 additions & 6 deletions api/v4/connectors/cosmosdb.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# CosmosDB

This connector simplifies accessing [Azure CosmosDB](https://azure.microsoft.com/en-us/products/cosmos-db/) databases.
This connector simplifies accessing [Azure CosmosDB](https://azure.microsoft.com/products/cosmos-db/) databases.
It supports the following .NET drivers:
- [Microsoft.Azure.Cosmos](https://www.nuget.org/packages/Microsoft.Azure.Cosmos), which provides a `CosmosClient`.

Expand All @@ -10,7 +10,7 @@ The remainder of this page assume you're familiar with the [basic concepts of St

To use this connector:

1. Create a CosmosDB server instance or use the [emulator](https://learn.microsoft.com/en-us/azure/cosmos-db/local-emulator).
1. Create a CosmosDB server instance or use the [emulator](https://learn.microsoft.com/azure/cosmos-db/local-emulator).
1. Add NuGet references to your project.
1. Configure your connection string in `appsettings.json`.
1. Initialize the Steeltoe Connector at startup.
Expand All @@ -24,7 +24,7 @@ Also add a NuGet reference to one of the .NET drivers listed above, as you would

### Configure connection string

The CosmosDB connection string can be obtained as described [here](https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/how-to-dotnet-get-started#retrieve-your-account-connection-string).
The CosmosDB connection string can be obtained as described [here](https://learn.microsoft.com/azure/cosmos-db/nosql/how-to-dotnet-get-started#retrieve-your-account-connection-string).

The following example `appsettings.json` uses the emulator:

Expand All @@ -50,17 +50,17 @@ as `CosmosDbOptions.Database`.

Update your `Program.cs` as below to initialize the Connector:

```c#
```csharp
using Steeltoe.Connectors.CosmosDb;

WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
var builder = WebApplication.CreateBuilder(args);
builder.AddCosmosDb();
```

### Use CosmosClient

Start by defining a class that contains container data:
```c#
```csharp
using Newtonsoft.Json;

public class SampleObject
Expand Down
18 changes: 9 additions & 9 deletions api/v4/connectors/microsoft-sql-server.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# Microsoft SQL Server

This connector simplifies accessing [Microsoft SQL Server](https://www.microsoft.com/en-us/sql-server) databases.
This connector simplifies accessing [Microsoft SQL Server](https://www.microsoft.com/sql-server) databases.
It supports the following .NET drivers:
- [Microsoft.Data.SqlClient](https://www.nuget.org/packages/Microsoft.Data.SqlClient), which provides an ADO.NET `DbConnection`.
- [System.Data.SqlClient](https://www.nuget.org/packages/System.Data.SqlClient), which provides an ADO.NET `DbConnection`.
- [Microsoft.EntityFrameworkCore.SqlServer](https://www.nuget.org/packages/Microsoft.EntityFrameworkCore.SqlServer), which provides [Entity Framework Core](https://learn.microsoft.com/en-us/ef/core/) support.
- [Microsoft.EntityFrameworkCore.SqlServer](https://www.nuget.org/packages/Microsoft.EntityFrameworkCore.SqlServer), which provides [Entity Framework Core](https://learn.microsoft.com/ef/core/) support.

The remainder of this page assumes you're familiar with the [basic concepts of Steeltoe Connectors](./usage.md).

## Usage

To use this connector:
1. Create a SQL Server instance or use [SQL Server Express LocalDB](https://learn.microsoft.com/en-us/sql/database-engine/configure-windows/sql-server-express-localdb).
1. Create a SQL Server instance or use [SQL Server Express LocalDB](https://learn.microsoft.com/sql/database-engine/configure-windows/sql-server-express-localdb).
1. Add NuGet references to your project.
1. Configure your connection string in `appsettings.json`.
1. Initialize the Steeltoe Connector at startup.
Expand All @@ -26,7 +26,7 @@ Also add a NuGet reference to one of the .NET drivers listed above, as you would

### Configure connection string

The available connection string parameters for SQL Server are documented [here](https://learn.microsoft.com/en-us/dotnet/api/microsoft.data.sqlclient.sqlconnection.connectionstring#remarks).
The available connection string parameters for SQL Server are documented [here](https://learn.microsoft.com/dotnet/api/microsoft.data.sqlclient.sqlconnection.connectionstring#remarks).

The following example `appsettings.json` uses SQL Server Express LocalDB:

Expand All @@ -48,10 +48,10 @@ The following example `appsettings.json` uses SQL Server Express LocalDB:

Update your `Program.cs` as below to initialize the Connector:

```c#
```csharp
using Steeltoe.Connectors.SqlServer;

WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
var builder = WebApplication.CreateBuilder(args);
builder.AddSqlServer();
```

Expand Down Expand Up @@ -87,7 +87,7 @@ public class HomeController : Controller
### Use Entity Framework Core

Start by defining your `DbContext` class:
```c#
```csharp
public class AppDbContext : DbContext
{
public DbSet<SampleEntity> SampleEntities => Set<SampleEntity>();
Expand All @@ -107,11 +107,11 @@ public class SampleEntity

Next, call the `UseSqlServer()` Steeltoe extension method from `Program.cs` to initialize Entity Framework Core:

```c#
```csharp
using Steeltoe.Connectors.EntityFrameworkCore.SqlServer;
using Steeltoe.Connectors.SqlServer;

WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
var builder = WebApplication.CreateBuilder(args);
builder.AddSqlServer();

builder.Services.AddDbContext<AppDbContext>(
Expand Down
6 changes: 3 additions & 3 deletions api/v4/connectors/mongodb.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,17 @@ as `MongoDbOptions.Database`.

Update your `Program.cs` as below to initialize the Connector:

```c#
```csharp
using Steeltoe.Connectors.MongoDb;

WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
var builder = WebApplication.CreateBuilder(args);
builder.AddMongoDb();
```

### Use IMongoClient

Start by defining a class that contains collection data:
```c#
```csharp
using MongoDB.Bson;

public class SampleObject
Expand Down
14 changes: 7 additions & 7 deletions api/v4/connectors/mysql.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ This connector simplifies accessing [MySQL](https://www.mysql.com/) databases.
It supports the following .NET drivers:
- [MySqlConnector](https://www.nuget.org/packages/MySqlConnector), which provides an ADO.NET `DbConnection`.
- [MySql.Data](https://www.nuget.org/packages/MySql.Data), which provides an ADO.NET `DbConnection`.
- [Pomelo.EntityFrameworkCore.MySql](https://www.nuget.org/packages/Pomelo.EntityFrameworkCore.MySql), which provides [Entity Framework Core](https://learn.microsoft.com/en-us/ef/core/) support.
- [MySql.EntityFrameworkCore](https://www.nuget.org/packages/MySql.EntityFrameworkCore), which provides [Entity Framework Core](https://learn.microsoft.com/en-us/ef/core/) support.
- [Pomelo.EntityFrameworkCore.MySql](https://www.nuget.org/packages/Pomelo.EntityFrameworkCore.MySql), which provides [Entity Framework Core](https://learn.microsoft.com/ef/core/) support.
- [MySql.EntityFrameworkCore](https://www.nuget.org/packages/MySql.EntityFrameworkCore), which provides [Entity Framework Core](https://learn.microsoft.com/ef/core/) support.

The remainder of this page assumes you're familiar with the [basic concepts of Steeltoe Connectors](./usage.md).

Expand Down Expand Up @@ -50,10 +50,10 @@ The following example `appsettings.json` uses the docker container from above:

Update your `Program.cs` as below to initialize the Connector:

```c#
```csharp
using Steeltoe.Connectors.MySql;

WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
var builder = WebApplication.CreateBuilder(args);
builder.AddMySql();
```

Expand Down Expand Up @@ -91,7 +91,7 @@ A complete sample app that uses `MySqlConnection` is provided at https://github.
### Use Entity Framework Core

Start by defining your `DbContext` class:
```c#
```csharp
public class AppDbContext : DbContext
{
public DbSet<SampleEntity> SampleEntities => Set<SampleEntity>();
Expand All @@ -111,11 +111,11 @@ public class SampleEntity

Next, call the `UseMySql()` Steeltoe extension method from `Program.cs` to initialize Entity Framework Core:

```c#
```csharp
using Steeltoe.Connectors.EntityFrameworkCore.MySql;
using Steeltoe.Connectors.MySql;

WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
var builder = WebApplication.CreateBuilder(args);
builder.AddMySql();

builder.Services.AddDbContext<AppDbContext>(
Expand Down
12 changes: 6 additions & 6 deletions api/v4/connectors/postgresql.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
This connector simplifies accessing [PostgreSQL](https://www.postgresql.org/) databases.
It supports the following .NET drivers:
- [Npgsql](https://www.nuget.org/packages/Npgsql), which provides an ADO.NET `DbConnection`.
- [Npgsql.EntityFrameworkCore.PostgreSQL](https://www.nuget.org/packages/Npgsql.EntityFrameworkCore.PostgreSQL), which provides [Entity Framework Core](https://learn.microsoft.com/en-us/ef/core/) support.
- [Npgsql.EntityFrameworkCore.PostgreSQL](https://www.nuget.org/packages/Npgsql.EntityFrameworkCore.PostgreSQL), which provides [Entity Framework Core](https://learn.microsoft.com/ef/core/) support.

The remainder of this page assumes you're familiar with the [basic concepts of Steeltoe Connectors](./usage.md).

Expand Down Expand Up @@ -48,10 +48,10 @@ The following example `appsettings.json` uses the docker container from above:

Update your `Program.cs` as below to initialize the Connector:

```c#
```csharp
using Steeltoe.Connectors.PostgreSql;

WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
var builder = WebApplication.CreateBuilder(args);
builder.AddPostgreSql();
```

Expand Down Expand Up @@ -89,7 +89,7 @@ A complete sample app that uses `NpgsqlConnection` is provided at https://github
### Use Entity Framework Core

Start by defining your `DbContext` class:
```c#
```csharp
public class AppDbContext : DbContext
{
public DbSet<SampleEntity> SampleEntities => Set<SampleEntity>();
Expand All @@ -109,11 +109,11 @@ public class SampleEntity

Next, call the `UseNpgsql()` Steeltoe extension method from `Program.cs` to initialize Entity Framework Core:

```c#
```csharp
using Steeltoe.Connectors.EntityFrameworkCore.PostgreSql;
using Steeltoe.Connectors.PostgreSql;

WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
var builder = WebApplication.CreateBuilder(args);
builder.AddPostgreSql();

builder.Services.AddDbContext<AppDbContext>(
Expand Down
4 changes: 2 additions & 2 deletions api/v4/connectors/rabbitmq.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ The following example `appsettings.json` uses the docker container from above:

Update your `Program.cs` as below to initialize the Connector:

```c#
```csharp
using Steeltoe.Connectors.RabbitMQ;

WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
var builder = WebApplication.CreateBuilder(args);
builder.AddRabbitMQ();
```

Expand Down
4 changes: 2 additions & 2 deletions api/v4/connectors/redis.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ The following example `appsettings.json` uses the docker container from above:

Update your `Program.cs` as below to initialize the Connector:

```c#
```csharp
using Steeltoe.Connectors.Redis;

WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
var builder = WebApplication.CreateBuilder(args);
builder.AddRedis();
```

Expand Down
Loading

0 comments on commit fc96828

Please sign in to comment.