Open Closed

About FileManagement Table Relation. #4644


User avatar
0
firatm created
  • ABP Framework version: v4.3.3
  • UI type: Angular
  • DB provider: EF Core (mssql)
  • Tiered (MVC) or Identity Server Separated (Angular): no
  • Exception message and stack trace:
  • Steps to reproduce the issue:" We are developing a Document management system using File Management.But we are having problems Deciphering the relationship between this file and the tables that exist in the database.These problems also cause us to have trouble getting the file information correct and improving it.We are having trouble accessing FMRELATION from FMFILEDESCRIPTION.These problems also cause us to have trouble getting the file information correct and improving it. It will be very useful for us if you share a visual explaining the relationships to us.In addition, we cannot convert data from IDirectoryDescriptorAppService with getqueryable. Can you help me with this issue?"

1 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    I suggest you understand these 4 entities from the code first.

    
    builder.Entity<DatabaseBlobContainer>(b =>
    {
        b.ToTable(AbpBlobStoringDatabaseDbProperties.DbTablePrefix + "BlobContainers", AbpBlobStoringDatabaseDbProperties.DbSchema);
    
        b.ConfigureByConvention();
    
        b.Property(p => p.Name).IsRequired().HasMaxLength(DatabaseContainerConsts.MaxNameLength);
    
        b.HasMany<DatabaseBlob>().WithOne().HasForeignKey(p => p.ContainerId);
    
        b.HasIndex(x => new { x.TenantId, x.Name });
    
        b.ApplyObjectExtensionMappings();
    });
    
    builder.Entity<DatabaseBlob>(b =>
    {
        b.ToTable(AbpBlobStoringDatabaseDbProperties.DbTablePrefix + "Blobs", AbpBlobStoringDatabaseDbProperties.DbSchema);
    
        b.ConfigureByConvention();
    
        b.Property(p => p.ContainerId).IsRequired(); //TODO: Foreign key!
            b.Property(p => p.Name).IsRequired().HasMaxLength(DatabaseBlobConsts.MaxNameLength);
        b.Property(p => p.Content).HasMaxLength(DatabaseBlobConsts.MaxContentLength);
    
        b.HasOne<DatabaseBlobContainer>().WithMany().HasForeignKey(p => p.ContainerId);
    
        b.HasIndex(x => new { x.TenantId, x.ContainerId, x.Name });
    
        b.ApplyObjectExtensionMappings();
    });
    
    
    builder.Entity<DirectoryDescriptor>(b =>
    {
        b.ToTable(FileManagementDbProperties.DbTablePrefix + "DirectoryDescriptors", FileManagementDbProperties.DbSchema);
    
        b.ConfigureByConvention();
    
        b.Property(p => p.Name).IsRequired().HasMaxLength(DirectoryDescriptorConsts.MaxNameLength);
    
        b.HasMany<DirectoryDescriptor>().WithOne().HasForeignKey(p => p.ParentId);
        b.HasOne<DirectoryDescriptor>().WithMany().HasForeignKey(p => p.ParentId);
    
        b.HasMany<FileDescriptor>().WithOne().HasForeignKey(p => p.DirectoryId);
    
        b.HasIndex(x => new { x.TenantId, x.ParentId, x.Name });
    
        b.ApplyObjectExtensionMappings();
    });
    
    builder.Entity<FileDescriptor>(b =>
    {
        b.ToTable(FileManagementDbProperties.DbTablePrefix + "FileDescriptors", FileManagementDbProperties.DbSchema);
    
        b.ConfigureByConvention();
    
        b.Property(p => p.Name).IsRequired().HasMaxLength(FileDescriptorConsts.MaxNameLength);
        b.Property(p => p.MimeType).IsRequired().HasMaxLength(FileDescriptorConsts.MaxMimeTypeLength);
        b.Property(p => p.Size).IsRequired().HasMaxLength(FileDescriptorConsts.MaxSizeLength);
    
        b.HasOne<DirectoryDescriptor>().WithMany().HasForeignKey(p => p.DirectoryId);
    
        b.HasIndex(x => new { x.TenantId, x.DirectoryId, x.Name });
    
        b.ApplyObjectExtensionMappings();
    });
    
    

    In addition, we cannot convert data from IDirectoryDescriptorAppService with getqueryable. Can you help me with this issue?

    Do you mean that repository cannot call this method? Which repository interface?

Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11