On Identity Mongo interface:
public interface IIdentityProMongoDbContext : IAbpIdentityMongoDbContext, IAbpMongoDbContext
{
}
public interface IAbpIdentityMongoDbContext : IAbpMongoDbContext
{
IMongoCollection<IdentityUser> Users { get; }
IMongoCollection<IdentityRole> Roles { get; }
IMongoCollection<IdentityClaimType> ClaimTypes { get; }
IMongoCollection<OrganizationUnit> OrganizationUnits { get; }
IMongoCollection<IdentitySecurityLog> SecurityLogs { get; }
IMongoCollection<IdentityLinkUser> LinkUsers { get; }
}
Identity Efcore Interface
public interface IIdentityServerDbContext : IEfCoreDbContext
{
#region ApiResource
DbSet<ApiResource> ApiResources { get; }
DbSet<ApiResourceSecret> ApiResourceSecrets { get; }
DbSet<ApiResourceClaim> ApiResourceClaims { get; }
DbSet<ApiResourceScope> ApiResourceScopes { get; }
DbSet<ApiResourceProperty> ApiResourceProperties { get; }
#endregion
#region ApiScope
DbSet<ApiScope> ApiScopes { get; }
DbSet<ApiScopeClaim> ApiScopeClaims { get; }
DbSet<ApiScopeProperty> ApiScopeProperties { get; }
#endregion
#region IdentityResource
DbSet<IdentityResource> IdentityResources { get; }
DbSet<IdentityResourceClaim> IdentityClaims { get; }
DbSet<IdentityResourceProperty> IdentityResourceProperties { get; }
#endregion
#region Client
DbSet<Client> Clients { get; }
DbSet<ClientGrantType> ClientGrantTypes { get; }
DbSet<ClientRedirectUri> ClientRedirectUris { get; }
DbSet<ClientPostLogoutRedirectUri> ClientPostLogoutRedirectUris { get; }
DbSet<ClientScope> ClientScopes { get; }
DbSet<ClientSecret> ClientSecrets { get; }
DbSet<ClientClaim> ClientClaims { get; }
DbSet<ClientIdPRestriction> ClientIdPRestrictions { get; }
DbSet<ClientCorsOrigin> ClientCorsOrigins { get; }
DbSet<ClientProperty> ClientProperties { get; }
#endregion
DbSet<PersistedGrant> PersistedGrants { get; }
DbSet<DeviceFlowCodes> DeviceFlowCodes { get; }
}
Why are some of those collections missing on the mongo interface?
For example the IdentityService: *.MongoDb based from your example:
//using ...
namespace ProjectName.IdentityService.MongoDb;
[ConnectionStringName(IdentityServiceDbProperties.ConnectionStringName)]
public class IdentityServiceDbContext : AbpMongoDbContext,
IIdentityServiceDbContext,
IIdentityProMongoDbContext,
IAbpIdentityServerMongoDbContext
{
public IMongoCollection<IdentityUser> Users { get; }
public IMongoCollection<IdentityRole> Roles { get; }
public IMongoCollection<IdentityClaimType> ClaimTypes { get; }
public IMongoCollection<OrganizationUnit> OrganizationUnits { get; }
public IMongoCollection<IdentitySecurityLog> SecurityLogs { get; }
public IMongoCollection<IdentityLinkUser> LinkUsers { get; }
public IMongoCollection<ApiResource> ApiResources { get; }
public IMongoCollection<ApiScope> ApiScopes { get; }
public IMongoCollection<Client> Clients { get; }
public IMongoCollection<IdentityResource> IdentityResources { get; }
public IMongoCollection<PersistedGrant> PersistedGrants { get; }
public IMongoCollection<DeviceFlowCodes> DeviceFlowCodes { get; }
//Create Model
}
On EFCore:
//using ...
namespace ProjectName.IdentityService.EntityFramework;
[ConnectionStringName(IdentityServiceDbProperties.ConnectionStringName)]
public class IdentityServiceDbContext : AbpDbContext<IdentityServiceDbContext>, IIdentityDbContext, IIdentityServerDbContext
{
public DbSet<IdentityUser> Users { get; set; }
public DbSet<IdentityRole> Roles { get; set; }
public DbSet<IdentityClaimType> ClaimTypes { get; set; }
public DbSet<OrganizationUnit> OrganizationUnits { get; set; }
public DbSet<IdentitySecurityLog> SecurityLogs { get; set; }
public DbSet<IdentityLinkUser> LinkUsers { get; set; }
public DbSet<ApiResource> ApiResources { get; set; }
public DbSet<ApiResourceSecret> ApiResourceSecrets { get; set; }
public DbSet<ApiResourceClaim> ApiResourceClaims { get; set; }
public DbSet<ApiResourceScope> ApiResourceScopes { get; set; }
public DbSet<ApiResourceProperty> ApiResourceProperties { get; set; }
public DbSet<ApiScope> ApiScopes { get; set; }
public DbSet<ApiScopeClaim> ApiScopeClaims { get; set; }
public DbSet<ApiScopeProperty> ApiScopeProperties { get; set; }
public DbSet<IdentityResource> IdentityResources { get; set; }
public DbSet<IdentityResourceClaim> IdentityClaims { get; set; }
public DbSet<IdentityResourceProperty> IdentityResourceProperties { get; set; }
public DbSet<Client> Clients { get; set; }
public DbSet<ClientGrantType> ClientGrantTypes { get; set; }
public DbSet<ClientRedirectUri> ClientRedirectUris { get; set; }
public DbSet<ClientPostLogoutRedirectUri> ClientPostLogoutRedirectUris { get; set; }
public DbSet<ClientScope> ClientScopes { get; set; }
public DbSet<ClientSecret> ClientSecrets { get; set; }
public DbSet<ClientClaim> ClientClaims { get; set; }
public DbSet<ClientIdPRestriction> ClientIdPRestrictions { get; set; }
public DbSet<ClientCorsOrigin> ClientCorsOrigins { get; set; }
public DbSet<ClientProperty> ClientProperties { get; set; }
public DbSet<PersistedGrant> PersistedGrants { get; set; }
public DbSet<DeviceFlowCodes> DeviceFlowCodes { get; set; }
// Constructor
// OnModelCreating
}
You can see there are collections that are not on the mongodbcontext. I can't seem to find interface for mongo that has the same required collections from Volo.Abp.IdentityServer.EntityFrameworkCore.IIdentityServerDbContext
One more related question, why do there are some collections missing on mongodb interface over efcore? e.g. IPaymentDbContext
has DbSet<GatewayPlan> GatewayPlans { get; }
but GatewayPlans
mongo collection is not present on IPaymentMongoDbContext
?
Same with some interface collections on IdentityServiceDbContext
over IdentityServiceDbContext
.
Oh I see, that helps. Thanks a lot!
Hi, gterdem thanks for the response. How about this one, I see IPermissionManagementDbContext
inherits IEfCoreDbContext
and also the others.
Q1: What are the existing interface for MongoDB that is equivalent to IPermissionManagementDbContext
, ISettingManagementDbContext
, etc.. that inherits IAbpMongoDbContext
?
Q2: The model builder configuration here are from Volo.Abp.*.EntityFrameworkCore
namespace, are there also ones equivalent for MongoDB?
using Microsoft.EntityFrameworkCore;
using Volo.Abp.AuditLogging;
using Volo.Abp.AuditLogging.EntityFrameworkCore;
using Volo.Abp.BlobStoring.Database;
using Volo.Abp.BlobStoring.Database.EntityFrameworkCore;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.FeatureManagement;
using Volo.Abp.FeatureManagement.EntityFrameworkCore;
using Volo.Abp.LanguageManagement;
using Volo.Abp.LanguageManagement.EntityFrameworkCore;
using Volo.Abp.PermissionManagement;
using Volo.Abp.PermissionManagement.EntityFrameworkCore;
using Volo.Abp.SettingManagement;
using Volo.Abp.SettingManagement.EntityFrameworkCore;
using Volo.Abp.TextTemplateManagement.EntityFrameworkCore;
using Volo.Abp.TextTemplateManagement.TextTemplates;
namespace ProjectName.AdministrationService.EntityFrameworkCore;
[ConnectionStringName(AdministrationServiceDbProperties.ConnectionStringName)]
public class AdministrationServiceDbContext : AbpDbContext<AdministrationServiceDbContext>,
IPermissionManagementDbContext,
ISettingManagementDbContext,
IFeatureManagementDbContext,
IAuditLoggingDbContext,
ILanguageManagementDbContext,
ITextTemplateManagementDbContext,
IBlobStoringDbContext
{
public DbSet<PermissionGrant> PermissionGrants { get; set; }
public DbSet<Setting> Settings { get; set; }
public DbSet<FeatureValue> FeatureValues { get; set; }
public DbSet<AuditLog> AuditLogs { get; set; }
public DbSet<Language> Languages { get; set; }
public DbSet<LanguageText> LanguageTexts { get; set; }
public DbSet<TextTemplateContent> TextTemplateContents { get; set; }
public DbSet<DatabaseBlobContainer> BlobContainers { get; set; }
public DbSet<DatabaseBlob> Blobs { get; set; }
public AdministrationServiceDbContext(DbContextOptions<AdministrationServiceDbContext> options)
: base(options)
{
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.ConfigurePermissionManagement();
modelBuilder.ConfigureSettingManagement();
modelBuilder.ConfigureFeatureManagement();
modelBuilder.ConfigureAuditLogging();
modelBuilder.ConfigureLanguageManagement();
modelBuilder.ConfigureTextTemplateManagement();
modelBuilder.ConfigureBlobStoring();
}
}
Cheers, Jeff B