An AspNet Identity provider implemented with ServiceStack.OrmLite.v3 (last version was 3.9.71). This provider can be used with all RDBMS that has a OrmLite Dialect (about eight (8)).
Install-Package AspNet.Identity.OrmLite
- Create an implementation of IDbConnectionFactory, using the OrmLite Dialect for the RDMS you are targeting, as follows:
var factory = new OrmLiteConnectionFactory(
/* Rdms-dependent-connection-string */
"...",
/* provider specific dialet here e.g. MySqlDialect.Provider, SQLiteDialect.Provider, etc */
SqlServerDialect.Provider
);
NOTE:
Nuget your RDMBS's OrmLite package. There are currently eight (8) flavours of OrmLite on NuGet (see list below). __HEADS-UP: You must INSTALL version 3.9.71 of your package to use this OrmLite provider).
- Sql Server (Pre-packaged with this identity provider)
- MySql
- PostgreSQL
- Oracle
- Firebird
- Sqlite32 - 32bit Mixed mode .NET only assembly
- Sqlite64 - 64bit Mixed mode .NET only assembly
- Sqlite.Mono - 32bit unmanaged dll, compatible with .NET / Mono
This identity provider come pre-packaged with MSSQL Server OrmLite, i.e. ServiceStack.OrmLite.SqlServer. Hence, you are not required to install it again when targetting SQL Server.
- Create an instance of OrmLiteIdentityDbContext instance using the created IDbConnectionFactory.
var context = new OrmLiteIdentityDbContext(factory);
- Create Asp.Net Identity UserManager and RoleManager like so:
var userManager = new UserManager<IdentityUser>(new UserStore(context));
// Optionally configure userManager instance
// Optionally store in a IoC Container
// ....
var roleManager = new RoleManager<IdentityRole>(new RoleStore(context));
// Optionally configure roleManager (e.g. RoleValidator)
// Optionally store in a IoC Container