Skip to content

Commit

Permalink
Fix readme typos (DbContext -> CosmosContext)
Browse files Browse the repository at this point in the history
  • Loading branch information
william-liebenberg committed Feb 10, 2021
1 parent 0eb499d commit fc03010
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion AzureGems.Repository.Abstractions/CosmosContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ public abstract class CosmosContext
{
// Nothing to see here

// Marker interface used for discovery of concrete dbContexts via reflection
// Marker interface used for discovery of concrete CosmosContexts via reflection
}
}
8 changes: 4 additions & 4 deletions AzureGems.Repository.CosmosDB/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Defining your `CosmosContext` is straight forward.
2. Declare a public `IRepository<T>` property for each model type (aka Domain Entity) with both `get` and `set` accessors.

```csharp
public class LittleNorthwindDbContext : CosmosContext
public class LittleNorthwindCosmosContext : CosmosContext
{
public IRepository<Customer> Customers { get; set; }
public IRepository<Order> Orders { get; set; }
Expand Down Expand Up @@ -41,7 +41,7 @@ services.AddCosmosDb(builder =>
});

// Add your CosmosContext
services.AddCosmosContext<LittleNorthwindDbContext>();
services.AddCosmosContext<LittleNorthwindCosmosContext>();
```

Now your `CosmosContext` is ready to be injected and used by your controllers/services.
Expand All @@ -51,9 +51,9 @@ Now your `CosmosContext` is ready to be injected and used by your controllers/se
```csharp
public class LittleNorthwindService
{
private readonly LittleNorthwindDbContext _dbContext;
private readonly LittleNorthwindCosmosContext _dbContext;

public LittleNorthwindService(LittleNorthwindDbContext dbContext)
public LittleNorthwindService(LittleNorthwindCosmosContext dbContext)
{
_dbContext = dbContext;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ services
...
});
})
.AddCosmosContext<DemoDbContext>();
.AddCosmosContext<DemoCosmosContext>();
```
2 changes: 1 addition & 1 deletion AzureGems.SpendOps.CosmosDB/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ services
...
});
})
.AddCosmosContext<DemoDbContext>();
.AddCosmosContext<DemoCosmosContext>();
```

TODO: Document TContext.ForFeature() extension (CosmosContextExtensions.cs) - tags all repos with the same feature - quickfire method
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,22 +57,22 @@ Sample implementation: [AzureGems.Repository.CosmosDB](https://github.com/willia

Cosmos DB specific implementation of the generic [Repository Pattern](https://deviq.com/repository-pattern/). `CosmosDbContainerRepository.cs` implements the `IRepository<T>` interface.

This library also aims to provide EFCore-like `DbContext`'s by simply declaring one or more `IRepository<T>` (`DbSet` in EFCore) inside a `CosmosDbContext` class.
This library also aims to provide EFCore-like `DbContext`'s by simply declaring one or more `IRepository<T>` (`DbSet` in EFCore) inside a `CosmosContext` class.

For example:

```csharp
public class LittleNorthwindDbContext : DbContext
public class LittleNorthwindCosmosContext : CosmosContext
{
public IRepository<Customer> Customers { get; set; }
public IRepository<Order> Orders { get; set; }
public IRepository<Invoice> Invoices { get; set; }
}
```

The `CosmosDbContainer` implementation already contains the definition of each container (see [AzureGems.CosmosDB](#AzureGemsCosmosDB)) and can instantiate the `IRepository<T>` instances via reflection when the `DbContext` is resolved from the `ServiceCollection`.
The `CosmosDbContainer` implementation already contains the definition of each container (see [AzureGems.CosmosDB](#AzureGemsCosmosDB)) and can instantiate the `IRepository<T>` instances via reflection when the `CosmosContext` is resolved from the `ServiceCollection`.

The instance of your `DbContext` can now be used in your application's services or controllers by constructor injection.
The instance of your `CosmosContext` can now be used in your application's services or controllers by constructor injection.

## AzureGems.SpendOps.Abstractions

Expand Down

0 comments on commit fc03010

Please sign in to comment.