Skip to content

Commit

Permalink
Merge pull request #13 from The-Standard-Organization/users/ZafarUrak…
Browse files Browse the repository at this point in the history
…ov/exposers-create-efxceptions-identity-context

EXPOSERS: Initialize EFxceptionsIdentityContext
  • Loading branch information
cjdutoit authored Jan 30, 2024
2 parents 4f2fb93 + a1eee31 commit fbcd393
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 0 deletions.
64 changes: 64 additions & 0 deletions STX.EFxceptions.Identity.Cosmos/EFxceptionsIdentityContext.cs
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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,14 @@
</None>
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.0.1" />
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.37.1" />
<PackageReference Include="STX.EFxceptions.Identity.Core" Version="0.1.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\STX.EFxceptions.Cosmos.Base\STX.EFxceptions.Cosmos.Base.csproj" />
</ItemGroup>

</Project>

0 comments on commit fbcd393

Please sign in to comment.