From 8beeaf463d9f8a367736f40f837e41e4fd157930 Mon Sep 17 00:00:00 2001 From: Alexandre SPIESER Date: Wed, 1 Nov 2017 09:34:21 +0000 Subject: [PATCH 1/3] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 36f3b99..3f09806 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ public class ApplicationRole : MongoIdentityRole } } ``` -The `Id` field is automatically set at instantiation, this also applies to users inheriting from `MongoIdentityUser`, where a random integer is assigned to the `Id`. It is however not advised to rely on such random mechanism to set the primary key of your document. Using documents inheriting from `MongoIdentityRole` and `MongoIdentityUser` is recommended. +The `Id` field is automatically set at instantiation, this also applies to users inheriting from `MongoIdentityUser`, where a random integer is assigned to the `Id`. It is however not advised to rely on such random mechanism to set the primary key of your document. Using documents inheriting from `MongoIdentityRole` and `MongoIdentityUser`, which both use the `Guid` type for primary keys, is recommended. To add the stores, you can use the `IdentityBuilder` extension like so: From 23d52d0275eb8e627a35f25e22c845e9bf647a72 Mon Sep 17 00:00:00 2001 From: Alexandre SPIESER Date: Tue, 14 Nov 2017 13:52:33 +0000 Subject: [PATCH 2/3] Update README.md --- README.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 3f09806..8bc68d5 100644 --- a/README.md +++ b/README.md @@ -55,16 +55,6 @@ services.AddIdentity() .AddDefaultTokenProviders(); ``` -It is also possible to share a common `IMongoDbContext` across your services: - -```csharp -var mongoDbContext = new MongoDbContext("mongodb://localhost:27017", "MongoDbTests"); -services.AddIdentity() - .AddMongoDbStores(mongoDbContext) - .AddDefaultTokenProviders(); -// Use the mongoDbContext for other things. -``` - You can also use the more explicit type declaration: ```csharp @@ -75,6 +65,16 @@ services.AddIdentity() // Use the mongoDbContext for other things. ``` +It is also possible to share a common `IMongoDbContext` across your services (requires https://www.nuget.org/packages/MongoDbGenericRepository/): + +```csharp +var mongoDbContext = new MongoDbContext("mongodb://localhost:27017", "MongoDbTests"); +services.AddIdentity() + .AddMongoDbStores(mongoDbContext) + .AddDefaultTokenProviders(); +// Use the mongoDbContext for other things. +``` + Alternatively a full configuration can be done by populating a `MongoDbIdentityConfiguration` object, which can have an `IdentityOptionsAction` property set to an action you want to perform against the `IdentityOptions` (`Action`). The `MongoDbSettings` object is used to set MongoDb Settings using the `ConnectionString` and the `DatabaseName` properties. From fc8032ee9e80637b3dc1f71f0c39f733de718772 Mon Sep 17 00:00:00 2001 From: Alexandre SPIESER Date: Tue, 14 Nov 2017 13:53:28 +0000 Subject: [PATCH 3/3] Update README.md --- README.md | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 8bc68d5..4ac1aee 100644 --- a/README.md +++ b/README.md @@ -55,15 +55,6 @@ services.AddIdentity() .AddDefaultTokenProviders(); ``` -You can also use the more explicit type declaration: - -```csharp -var mongoDbContext = new MongoDbContext("mongodb://localhost:27017", "MongoDbTests"); -services.AddIdentity() - .AddMongoDbStores(mongoDbContext) - .AddDefaultTokenProviders(); -// Use the mongoDbContext for other things. -``` It is also possible to share a common `IMongoDbContext` across your services (requires https://www.nuget.org/packages/MongoDbGenericRepository/): @@ -75,6 +66,16 @@ services.AddIdentity() // Use the mongoDbContext for other things. ``` +You can also use the more explicit type declaration: + +```csharp +var mongoDbContext = new MongoDbContext("mongodb://localhost:27017", "MongoDbTests"); +services.AddIdentity() + .AddMongoDbStores(mongoDbContext) + .AddDefaultTokenProviders(); +// Use the mongoDbContext for other things. +``` + Alternatively a full configuration can be done by populating a `MongoDbIdentityConfiguration` object, which can have an `IdentityOptionsAction` property set to an action you want to perform against the `IdentityOptions` (`Action`). The `MongoDbSettings` object is used to set MongoDb Settings using the `ConnectionString` and the `DatabaseName` properties.