Class 'QueryDb' used before its declaration

I have issue with generated DTO which I think is because I have nested a QueryDb class as a property.

Error is

Class ‘QueryDb’ used before its declaration

I have this QueryDb class on backend:

public class FindGodaddyExpiring : QueryDb<GodaddyExpiringSearchView, GodaddyExpiringSearchViewResponse>

I give the user the option to save a search to the database and re-run it later so I have this ormlite class table.

[CompositeIndex(nameof(MyUserAuthId), nameof(AlertName))]
public class DomainAlert : IReturn<DomainAlert>
    public int Id { get; set; }
    [ForeignKey(typeof(MyUserAuth), OnDelete = "CASCADE")]
    public int MyUserAuthId { get; set; }
    public string AlertName { get; set; }
    public DateTime Created { get; set; } = DateTime.Now;
    public GridRequestState GridRequestState { get; set; }
    public DomainAlertSource Source { get; set; }

It was working OK until I refactored code to include GridRequestState that has my QueryDb class embedded in it.

public class GridRequestState
    public Dictionary<string, string> QueryParameters { get; set; }
    public FindGodaddyExpiring Request { get; set; }
    public AgGridSortModel[] SortModel { get; set; }
    public AgGridFilterModel[] FilterModel { get; set; }

The reason I want to save the request is so I can re-run the autoquery outside of my service in various cron tasks.

I guess the DTO generator isn’t expecting a nested QueryDb property which effects the ordering.

If I manually move QueryDb and QueryBase higher up in the code the error goes away.

Did I do something wrong? What should I do so DTO generates without error?

The issue is adding a dependency to Request DTOs inside a Type which messes up the Types dependency resolution strategy since it’s assumed that Request DTOs are the start of the dependency tree and there’s no cyclical deps of Types referencing them which isn’t a use-case it was designed to support.