-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from The-Standard-Organization/users/ZafarUrak…
…ov/exposers-create-efxceptions-identity-context EXPOSERS: Initialize EFxceptionsIdentityContext
- Loading branch information
Showing
2 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
64 changes: 64 additions & 0 deletions
64
STX.EFxceptions.Identity.Cosmos/EFxceptionsIdentityContext.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// ---------------------------------------------------------------------------------- | ||
// Copyright(c) The Standard Organization: A coalition of the Good-Hearted Engineers | ||
// ---------------------------------------------------------------------------------- | ||
|
||
using System; | ||
using Microsoft.AspNetCore.Identity; | ||
using Microsoft.Azure.Cosmos; | ||
using Microsoft.EntityFrameworkCore; | ||
using STX.EFxceptions.Cosmos.Base.Brokers.DbErrorBroker; | ||
using STX.EFxceptions.Cosmos.Base.Services.Foundations; | ||
using STX.EFxceptions.Identity.Core; | ||
using STX.EFxceptions.Interfaces.Brokers.DbErrorBroker; | ||
using STX.EFxceptions.Interfaces.Services.EFxceptions; | ||
|
||
namespace STX.EFxceptions.Identity.Cosmos | ||
{ | ||
public class EFxceptionsIdentityContext<TUser, TRole, TKey> | ||
: IdentityDbContextBase<TUser, TRole, TKey, IdentityUserClaim<TKey>, IdentityUserRole<TKey>, | ||
IdentityUserLogin<TKey>, IdentityRoleClaim<TKey>, IdentityUserToken<TKey>, CosmosException> | ||
where TUser : IdentityUser<TKey> | ||
where TRole : IdentityRole<TKey> | ||
where TKey : IEquatable<TKey> | ||
{ | ||
public EFxceptionsIdentityContext(DbContextOptions options) : base(options) | ||
{ } | ||
|
||
protected EFxceptionsIdentityContext() : base() | ||
{ } | ||
|
||
protected override IDbErrorBroker<CosmosException> CreateErrorBroker() => | ||
new CosmosErrorBroker(); | ||
|
||
protected override IEFxceptionService<CosmosException> CreateEFxceptionService( | ||
IDbErrorBroker<CosmosException> errorBroker) => | ||
new CosmosEFxceptionService(errorBroker); | ||
} | ||
|
||
public class EFxceptionsIdentityContext< | ||
TUser, TRole, TKey, TUserClaim, TUserRole, TUserLogin, TRoleClaim, TUserToken> | ||
: IdentityDbContextBase<TUser, TRole, TKey, | ||
TUserClaim, TUserRole, TUserLogin, TRoleClaim, TUserToken, CosmosException> | ||
where TUser : IdentityUser<TKey> | ||
where TRole : IdentityRole<TKey> | ||
where TKey : IEquatable<TKey> | ||
where TUserClaim : IdentityUserClaim<TKey> | ||
where TUserRole : IdentityUserRole<TKey> | ||
where TUserLogin : IdentityUserLogin<TKey> | ||
where TRoleClaim : IdentityRoleClaim<TKey> | ||
where TUserToken : IdentityUserToken<TKey> | ||
{ | ||
public EFxceptionsIdentityContext(DbContextOptions options) : base(options) | ||
{ } | ||
|
||
protected EFxceptionsIdentityContext() : base() | ||
{ } | ||
|
||
protected override IDbErrorBroker<CosmosException> CreateErrorBroker() => | ||
new CosmosErrorBroker(); | ||
|
||
protected override IEFxceptionService<CosmosException> CreateEFxceptionService( | ||
IDbErrorBroker<CosmosException> errorBroker) => | ||
new CosmosEFxceptionService(errorBroker); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters