2
votes

For a web app I would normally attach a class library project that would then hit the database as everything co-located. But for Blazor WebAssembly, since the bits are essentially downloaded to the client browser, is it important to then have the app hit an API instead?

I.e. since the app would then kind of be like a Windows app and go across HTTP for more than just the HTML, is it important then (in that case) to use an API and NOT reference a class library from the web app?

Thank you so much for any replies.

1

1 Answers

4
votes

class library and Database use are not so directly related.

You can use class libraries, no problem. In both types of Blazor apps.

The only released Blazor is server-side and there you can use a Db directly.

But you cannot use a Db directly from Blazor WebAssembly. You can share a class lib with Entity (or DTO) classes between the Client and an API-server.