Update README.md
This commit is contained in:
committed by
GitHub
parent
0dc4240d2c
commit
863003167b
@@ -1,4 +1,4 @@
|
|||||||
# Microsoft.AspNetCore.Identity.MongoDbCore
|
# AspNetCore.Identity.MongoDbCore
|
||||||
A MongoDb UserStore and RoleStore adapter for Microsoft.AspNetCore.Identity 2.0.
|
A MongoDb UserStore and RoleStore adapter for Microsoft.AspNetCore.Identity 2.0.
|
||||||
Allows you to use MongoDb instead of SQL server with Microsoft.AspNetCore.Identity 2.0.
|
Allows you to use MongoDb instead of SQL server with Microsoft.AspNetCore.Identity 2.0.
|
||||||
Covered by 730+ integration tests and unit tests from the modified Microsoft.AspNetCore.Identity.EntityFrameworkCore.Test test suite.
|
Covered by 730+ integration tests and unit tests from the modified Microsoft.AspNetCore.Identity.EntityFrameworkCore.Test test suite.
|
||||||
@@ -9,28 +9,33 @@ Your user and role entities must inherit from MongoIdentityUser<Guid> and MongoI
|
|||||||
|
|
||||||
```csharp
|
```csharp
|
||||||
|
|
||||||
public class ApplicationRole : MongoIdentityRole<Guid>
|
public class ApplicationRole : MongoIdentityRole<Guid>
|
||||||
|
{
|
||||||
|
public ApplicationRole() : base()
|
||||||
{
|
{
|
||||||
public ApplicationRole() : base()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public ApplicationRole(string roleName) : base(roleName)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ApplicationUser : MongoIdentityUser<Guid>
|
public ApplicationRole(string roleName) : base(roleName)
|
||||||
{
|
{
|
||||||
public ApplicationUser() : base()
|
}
|
||||||
{
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public ApplicationUser(string userName, string email) : base(userName, email)
|
public class ApplicationUser : MongoIdentityUser<Guid>
|
||||||
{
|
{
|
||||||
}
|
public ApplicationUser() : base()
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ApplicationUser(string userName, string email) : base(userName, email)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
The configuration is done by populating a `MongoDbIdentityConfiguration` object, which can have an `IdentityOptionsAction` property set to an action you want to perform against the `IdentityOptions` (`Action<IdentityOptions>`).
|
||||||
|
The MongoDbSettings object is used to set MongoDb Settings using the `ConnectionString` and the `DatabaseName` properties.
|
||||||
|
The MongoDb connection is managed using the [mongodb-generic-repository](https://github.com/alexandre-spieser/mongodb-generic-repository), where a repository inheriting `IBaseMongoRepository` is registered as a singleton. Look at the [ServiceCollectionExtension.cs](https://github.com/alexandre-spieser/AspNetCore.Identity.MongoDbCore/blob/master/src/Extensions/ServiceCollectionExtension.cs) for more details.
|
||||||
|
|
||||||
|
```csharp
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This method gets called by the runtime. Use this method to add services to the container.
|
/// This method gets called by the runtime. Use this method to add services to the container.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user