Needing to supply the typed AutoQuery DTOs the component should use is a concession as we canât do dynamic magic type inference in C# like we can do in JS.
Apis could be constructed with runtime types in its Apis(Type[] types) Constructor but youâre not going to be able to resolve those server generated types in WASM, might work in Blazor Server but weâre not going to support that use-case if it requires any architectural concessions.
Youâre best off Exporting to code-first Types to utilize it, which basically applies to every âAPI awareâ component in ServiceStack.Blazor Components.
Trying the code first approach, similar to the Bookings example
[Schema("dbo")]
public class MyobCustomer
{
[AutoIncrement]
public int Id { get; set; }
...
}
[Route("/myobcustomers", "GET")]
[Route("/myobcustomers/{Id}", "GET")]
public class QueryMyobCustomers : QueryDb<MyobCustomer>
{
public int? Id { get; set; }
}
I can compile the Blazor WASM project as it now understands QueryMyobCustomers
and in that case it is working but that does not make sense (I am reversing to the Database first approach) and the declaration in the Models of QueryMyobCustomers is only helping Blazor to find what it needs, but not helping to generate the CRUD servicesâŠ
Not sure, they should be discovered. Did you add the AutoQuery DTOs along side the Bookings AutoQuery DTOs in the template? Did the Bookings DTOs stop appearing in the /metadata page as well?
I added back the Bookings DTOs, running locally and using Sqlite
and nothing in the /metadata
Sorry, there must be something wrong with my project. Will restart from the beginning
If found this issue.
If we remove the Hello service code from the MyServices.cs class in the MyApp.ServiceInterface project, the class is empty and then the AutoQuery CRUD Services do not get generated! If you add back the Hello service code, then the CRUD Services are again generated.
Iâm assuming itâs an issue with assembly resolution then, is your MyServices class still used in the AppHost constructor and does it still have DTOs in the ServiceModel project?
It can only find them from the AppHost constructor Assembly which looks at the ServiceInterface Assembly which would need to have existing Services and DTOs in ServiceModel in order to be able to scan it as well.