I have given you access to a repository for another issue I'm having while creating this sample project for you.
Hi,
While creating a new solution to demonstrate to support an issue I'm having with implementing a custom data filter I am getting a Connection Refused error on the sample project. I created this project using ABP Studio and then using ABP Suite to add the MaintenanceModule's project to my solution. I've create a github repo for this sample project and have given maliming access to it.
Please let me know what the issue is so I can continue working on it to demonstrate the other issue I already have a ticket open for.
Steve
Hi,
Do you have a place where I can share some sample code with you so you can help me determine what the issue is that I'm getting with this?
I am asking you specific questions and you’re not answering them at all.
I’ve asked you to detail where the changes such as the interface class goes representing the data filter so that it can be added to domain classes in other tiered modules I’m referencing.
This is what the current DBContext class is for my blazor app. I have not implemented the suggested changes from your post the details them out, but I don't want to have to make this change to all my other ABP generated modules in my solution. I asked previously if those other DB contexts ( ILanguageManagementDbContext, ISystemMaintenanceDbContext, IReportQuickDesignerDbContext and ISecurityDbContext) also need these changes or if just having the [ReplaceDBContext] negates that and you have not responded directly to that question.
I also asked if you could detail what projects each of the proposed changes in your post (https://abp.io/community/articles/switching-between-organization-units-i5tokpzt) as it's not clear which projects they should go so the project compiles correctly.
Again seeing an actual example of a tiered blazor WASM solution referencing an ABP Generated Module (with it's own DBContext) being referenced by this blazor wasm project would be helpful.
namespace CFDataSystems.StructureCloud.EntityFrameworkCore;
[ConnectionStringName(StructureCloudDbProperties.HostConnectionStringName)]
[ReplaceDbContext(typeof(IIdentityProDbContext))]
[ReplaceDbContext(typeof(IIdentityDbContext))]
[ReplaceDbContext(typeof(ISaasDbContext))]
[ReplaceDbContext(typeof(ILanguageManagementDbContext))]
[ReplaceDbContext(typeof(ISystemMaintenanceDbContext))]
[ReplaceDbContext(typeof(IReportQuickDesignerDbContext))]
[ReplaceDbContext(typeof(ISecurityDbContext))]
public class StructureCloudDbContext : AbpDbContext<StructureCloudDbContext>,
IStructureCloudDbContext,
IIdentityProDbContext,
IIdentityDbContext,
ISaasDbContext,
ILanguageManagementDbContext,
ISystemMaintenanceDbContext,
IReportQuickDesignerDbContext,
ISecurityDbContext
{
//Custom Tables
public DbSet<TenantInformation> TenantInformation { get; set; }
public DbSet<Screen> Screens { get; set; }
public DbSet<UserDashboard> UserDashboards { get; set; }
public DbSet<UserInformation> UserInformation { get; set; }
public DbSet<UserLaunch> UserLaunch { get; set; }
public DbSet<Template> Template { get; set; }
//Saas Tables
public DbSet<Tenant> Tenants { get; set; }
public DbSet<Edition> Editions { get; set; }
public DbSet<TenantConnectionString> TenantConnectionStrings { get; set; }
//Itentity Tables
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<IdentityUserDelegation> UserDelegations { get; }
//Language tables
public DbSet<Language> Languages { get; set; }
public DbSet<LanguageText> LanguageTexts { get; set; }
public DbSet<LocalizationResourceRecord> LocalizationResources { get; set; }
public DbSet<LocalizationTextRecord> LocalizationTexts { get; set; }
//System Maintenance Tables
public DbSet<SystemMaintenance.Domain.Attributes.Attribute> Attribute { get; set; }
public DbSet<DataView> Views { get; set; }
public DbSet<ViewJoin> ViewJoins { get; set; }
public DbSet<JoinField> JoinFields { get; set; }
public DbSet<CalculatedField> CalculatedFields { get; set; }
public DbSet<ReferencedField> ReferencedFields { get; set; }
public DbSet<DataType> DataTypes { get; set; }
public DbSet<DataSourceQuery> DataSourceQueries { get; set; }
public DbSet<DataSourceHeader> DataSourceHeaders { get; set; }
public DbSet<DataSourceDetail> DataSourceDetails { get; set; }
public DbSet<DataSourceProcedure> DataSourceProcedures { get; set; }
public DbSet<Application> Applications { get; set; }
public DbSet<Procedure> Procedures { get; set; }
public DbSet<MenuGroup> MenuGroups { get; set; }
public DbSet<RaiqiHeader> RaiqiHeader { get; set; }
public DbSet<RaiqiDetail> RaiqiDetails { get; set; }
public DbSet<Parameter> Parameters { get; set; }
public DbSet<SqlTables> SqlTables { get; set; }
//Security Tables
public DbSet<SecurityRole> SecurityRoles { get; set; }
public DbSet<SecurityRoleProcedure> SecurityRoleProcedures { get; set; }
public DbSet<UserSecurityRole> UserSecurityRoles { get; set; }
public DbSet<SecurityRoleStructure> SecurityRolesStructure { get; set; }
public DbSet<SecurityRoleStructureWithProcedures> SecurityRolesStructureWithProcedures { get; set; }
public DbSet<UserPermissionView> UserPermissions { get; set; }
public StructureCloudDbContext(DbContextOptions<StructureCloudDbContext> options)
: base(options)
{
}
protected override void OnModelCreating(ModelBuilder builder)
{
//base.OnModelCreating(builder);
builder.SetMultiTenancySide(MultiTenancySides.Host);
if (builder.IsHostDatabase())
{
ConfigurDatabaseSettings(builder);
}
builder.HasDefaultSchema("public");
base.OnModelCreating(builder);
}
private void ConfigurDatabaseSettings(ModelBuilder builder)
{
AbpCommonDbProperties.DbTablePrefix = string.Empty;
builder.ConfigurePermissionManagement();
builder.ConfigureSettingManagement();
builder.ConfigureBackgroundJobs();
builder.ConfigureIdentityPro();
builder.ConfigureFeatureManagement();
builder.ConfigureLanguageManagement();
builder.ConfigureAuditLogging();
//PaymentDbProperties.DbTablePrefix = string.Empty;
//builder.ConfigurePayment();
builder.ConfigureOpenIddict();
SaasDbProperties.DbTablePrefix = string.Empty;
builder.ConfigureSaas();
TextTemplateManagementDbProperties.DbTablePrefix = string.Empty;
builder.ConfigureTextTemplateManagement();
builder.ConfigureBlobStoring();
builder.ConfigureGdpr();
//builder.ConfigureCmsKit();
//builder.ConfigureCmsKitPro();
builder.ConfigureHostTables();
StructureCloudDbProperties.DbSchema = "structurecloud_settings";
builder.ConfigureSystemMaintenance();
builder.ConfigureSecurity();
AccountsPayableDbProperties.DbSchema = "vision";
builder.ConfigureAccountsPayable();
AccountsReceivableDbProperties.DbSchema = "vision";
builder.ConfigureAccountsReceivable();
JobCostDbProperties.DbSchema = "vision";
builder.ConfigureJobCost();
WorkOrderDbProperties.DbSchema = "vision";
builder.ConfigureWorkOrders();
PurchaseOrderDbProperties.DbSchema = "vision";
builder.ConfigurePurchaseOrders();
builder.ConfigureReportQuickDesigner();
}
}
Hi,
Also what's confusing to me is that the link you provided is not specific to a Blazor WASM project, so it's confusing to know which of the classes mentioned in the link your provided go into which project in our tiered solution structure. As a reminder we are running a Blazor WASM project hosted in the abp generated 'public' website module. If you could also demonstrate where these classes go in terms of which project.
Is it possible you can generate a sample project of how to do what I originally asked for but using a Blazor WASM project?
Hi,
Would I use the method in this link (https://abp.io/docs/latest/framework/data/entity-framework-core#replacedbcontext-attribute) to achieve my requirement of having all the other DBContext objects, across all my modules in my solution applying this new data filter?
Hi,
I appreciate this link and it contains some helpful information however, I still do not see how this would be applied to all my DBContext implementations across all my modules as I indicated in my initial message.
I need to implement a new datafilter called ICompany which will hold a guid for the current company a user has chosen. This filter needs to be used across several abp modules each with their own DBContext. What's the best way to implement this given my use case and how would I go about setting the CompanyId for this filter when a user changes the current company guid they are wanting to filter the data with.
public interface ICompany { Guid CompanyId { get; set; } }
Yes, I have look at the following documentation (https://abp.io/docs/latest/framework/infrastructure/data-filtering#defining-custom-filters), but this implies I need to do this for every DBContext in every module I create which seems like too much to accomplish this.
I am using an ABP Blazor WASM generated application. I would like to somehow hook into it an MVC page either contained in the Blazor WASM project itself or a seperate project that the Blazor WASM application can render a page from. My core issue is I have an ASP.NET core control that has no Blazor equivalent but still want to put it on a razor page (mvc based) so it looks like a page running within the Blazor WASM application.
How can I accomplish this?