Open Closed

LimitedResultRequestDto is missing when generating code with 10.7 #10949


User avatar
0
ageiter created

I’ve updated my project to 10.7.0 and regenerated the entities using the suite. Thanks in advance for the fixes included in the new version.

However, I now have a new problem. The new Server.Tests.Application.txt template now references a class called LimitedResultRequestDto, which I don’t yet have in my project.

In my opinion, this should be included in Volo.Abp.Application.Dtos, just like PagedResultRequestDto, but it doesn’t seem to be there.

Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)

18 Answer(s)
  • User Avatar
    0
    AI-Bot created
    Support Team ABP Agent
    • LimitedResultRequestDto is an ABP Framework type and it should come from the Volo.Abp.Application.Dtos namespace (same place as PagedResultRequestDto).
    • In ABP 10.7, PagedResultRequestDto inherits from LimitedResultRequestDto (so Suite templates referencing LimitedResultRequestDto is consistent with the framework DTO hierarchy).

    What to do in your solution (ABP 10.7.0):

    1. Ensure your projects reference the correct ABP package(s)

      • The DTO base classes (LimitedResultRequestDto, PagedResultRequestDto, etc.) come from ABP’s application contracts layer packages (transitively or directly).
      • Make sure the project where the template is compiled (typically *.Application.Contracts and/or *.TestBase / *.Tests) references ABP 10.7.0 packages consistently (no mixed versions).
    2. Clean and restore to eliminate stale assemblies

      • Delete bin/obj for the solution (or run dotnet clean + delete bin/obj).
      • Run dotnet restore
      • Rebuild the whole solution.
    3. If you still can’t compile because the type is missing

      • That indicates your solution is not actually resolving the ABP 10.7 assemblies that contain the DTOs (e.g., package downgrade, pinned central package version, or inconsistent package graph).
      • Fix by aligning all Volo.Abp.* package versions to 10.7.0 (including test projects).

    Reference (contains the LimitedResultRequestDto and shows its relationship to PagedResultRequestDto / PagedAndSortedResultRequestDto):

    • https://abp.io/docs/10.7/framework/architecture/domain-driven-design/data-transfer-objects

    This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    ageiter created

    It’s all right, it was my mistake. When I merged the template, I forgot to add the new using Volo.Abp.Application.Dtos statement.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Hi,

    Thanks for letting us know. Feel free to open a new question if anything else comes up.

    Thanks

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    ageiter created

    Could you make these test classes (such as the one mentioned above) partial in future, so that we can add our own extended class for further tests? I’ve now had to adapt this in my template.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Hi,

    Thanks for the suggestion. We'll make the generated test classes partial in the next release: the abstract *AppServiceTests<TStartupModule>, the EF Core/MongoDB *AppServiceTests classes, and *RepositoryTests.

    Until then, you can keep the partial change in your customized template.

    Thanks

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    ageiter created

    Great thank you!

    One more request: I’ve created a base class for the two DbContexts (Host & Tenant) and moved the shared EF model definition there (I don’t like duplicate code). And for tables that I only want in the Hosts database, I still have the option of defining them there alone.

    As these are table definitions, I otherwise see a risk that discrepancies could arise if a manual change is made, because the change is only made in one place.

    Could you please consider whether you might want to do the same for the generated code?

    public abstract class BpoDbContextBase<TDbContext> : AbpDbContext<TDbContext>
        where TDbContext : DbContext
    { 
    ... 
    }
    
    [ConnectionStringName("Default")]
    public class BpoDbContext : BpoDbContextBase<BpoDbContext>
    {
        public DbSet<Kunde> Kunden { get; set; } = null!;
    
        public BpoDbContext(DbContextOptions<BpoDbContext> options)
            : base(options)
        {
        }
    
        protected override void OnModelCreating(ModelBuilder builder)
        {
            builder.SetMultiTenancySide(MultiTenancySides.Both);
            base.OnModelCreating(builder);
    
            // Configure mappings like that for the entities only available in the host side, but should not be in the tenant databases.
    
            if (builder.IsHostDatabase())
            {
                builder.Entity<Kunde>(b =>
                {
                    b.ToTable(BpoConsts.DbTablePrefix + "Kunde", BpoConsts.DbSchema);
                    b.ConfigureByConvention();
                    b.Property(x => x.Kundennummer).HasColumnName(nameof(Kunde.Kundennummer));
                    b.Property(x => x.Name).HasColumnName(nameof(Kunde.Name)).IsRequired().HasMaxLength(KundeConsts.NameMaxLength);
                });
            }
        }
    }
    
    [ConnectionStringName("Default")]
    public class BpoTenantDbContext : BpoDbContextBase<BpoTenantDbContext>
    {
        public BpoTenantDbContext(DbContextOptions<BpoTenantDbContext> options)
            : base(options)
        {
        }
    
        protected override void OnModelCreating(ModelBuilder builder)
        {
            builder.SetMultiTenancySide(MultiTenancySides.Tenant);
            base.OnModelCreating(builder);
        }
    }
    
    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    ageiter created

    One more thing I’ve noticed. I think the new feature “RemoveUnusedUsings”: true doesn’t seem to be working. I’ve set it to true, but I still have a lot of unused usings after generation.

    Here are a few examples (this list is not complete):

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    ageiter created

    To this end, changes are made to the formatting in the extended file (which do not comply with our style guidelines).

    I have seen this in the following classes:

    Domain:

    • Entity.Extended.cs
    • EntityManager.Extended.cs
    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    ageiter created

    The Const files are overwritten each time. Would it be possible to introduce Extended files here as well, so that we can store our own constants?

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    ageiter created

    Unfortunately, there’s another error… when generating EfCore…Repository.cs, there’s a mix-up with the using statements:

    I couldn’t figure out what was causing the problem. The template appears to be the same as before (I haven’t customised anything here). Nor did the RemoveUnusedUsings parameter have any effect when I set it to false.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    ageiter created

    One more thing: Why is a required navigation property now made nullable?

    It's a master entity with two navigation properties (1:n). Both are required. In version 10.4, this was generated correctly.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    ageiter created

    Sorry for all the different findings. I’d like to help improve the product. I’ve deliberately split it into six separate posts so that you can reply to them more easily. Thank you very much.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Hi,

    The app template already generates a BpoDbContextBase<TDbContext> like yours when you choose a separate tenant database. Suite doesn't use it yet. For a multi-tenant entity, it writes the mapping into both DbContexts.

    For now, you can make Suite write the mappings into one place:

    1. Add a BpoDbContextModelCreatingExtensions.cs file to the EntityFrameworkCore project. When this file exists, Suite writes the entity mappings into its first Configure... method instead of BpoDbContext:
    using Microsoft.EntityFrameworkCore;
    
    namespace Bpo.EntityFrameworkCore;
    
    public static class BpoDbContextModelCreatingExtensions
    {
        public static void ConfigureBpo(this ModelBuilder builder)
        {
        }
    }
    
    1. Call it in BpoDbContextBase.OnModelCreating, after the module configurations:
    builder.ConfigureBpo();
    
    1. Move your existing entity mappings into ConfigureBpo.

    Suite puts the host-only entities inside if (builder.IsHostDatabase()) in this method. For a multi-tenant entity, it still adds a second copy of the mapping to BpoTenantDbContext. Delete that copy after you generate the entity. The tenant model is the same without it.

    We'll consider using the base class directly in Suite.

    Thanks

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Hi,

    About the broken usings in EfCoreProjektDokumentRepository.cs: Suite 10.7.0 breaks the using Bpo.EntityFrameworkCore; line when it adds the usings of the navigation properties. The RemoveUnusedUsings option doesn't change it. We've fixed it, and the fix will be in the next patch release.

    Until then, you can change the Suite template once:

    1. Open the Templates page in Suite, search for Server.Repository.EfCoreRepository.txt and edit it.
    2. Replace this line:
    using %%solution-namespace%%.%%dbcontext-namespace%%;
    

    with:

    using Bpo.EntityFrameworkCore;
    
    1. Save it and generate the entity again.

    The change only applies to this solution. You can restore the template to default after you upgrade.

    Thanks

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Hi,

    About RemoveUnusedUsings: Suite keeps the cleanup only if the solution builds after it. Apply the template change from my previous reply, make sure the solution builds, then generate the entity again. Existing .Extended.cs files are excluded from this cleanup because they contain your own code, so you can clean up their unused usings in your IDE.

    About the .Extended.cs formatting: Suite 10.7.0 reformats the whole file when it updates the generated constructor. We're working on a fix so Suite only changes the generated constructor and keeps the rest of your code as it is. It isn't released yet.

    About the consts: the consts files are regenerated each time. Thanks for the suggestion, we'll pass it to the Suite team.

    About the nullable navigation properties: in 10.7, the navigation properties in *WithNavigationProperties and its DTO are nullable on purpose. The list query loads them with a left join, so they can be null when the related record is soft-deleted. The foreign key itself is still required.

    Thanks

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    ageiter created

    Thank you for all your replies. For most things, I can wait for the next release.

    One more question regarding your reply:

    About RemoveUnusedUsings: Suite keeps the cleanup only if the solution builds after it. Apply the template change from my previous reply, make sure the solution builds, then generate the entity again. Existing .Extended.cs files are excluded from this cleanup because they contain your own code, so you can clean up their unused usings in your IDE.

    Is this only the case when generating via the UI, or does it do the same when I trigger the generation via the CLI? abp suite generate -e $file.FullName -s $SolutionPath Or should it work even then, and is the only problem I’m having that it couldn’t be compiled?

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    ageiter created

    What really annoys me when working in the Suite is the pop-up that appears after saving. A toast notification would be enough.

    Sometimes I go through all the entities and make a few changes, save them, and want to move straight on to the next one without having to click OK every time. For example, when I enabled ‘Remove unused usings’ for all of them.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Hi,

    About the CLI: abp suite generate uses the same cleanup as the UI when "RemoveUnusedUsings": true is set in the entity JSON you pass with -e. Apply the template change from my earlier reply, make sure the solution builds, then generate the entity again with the CLI. If unused usings are still there, check the Suite log in %USERPROFILE%\.abp\suite\logs for the cleanup warning.

    About the pop-up after saving: we'll pass your suggestion for a toast to the Suite team.

    Thanks

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.8.0-preview. Updated on October 30, 2026, 06:34
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.