Best Practice For Database Access In Blazor MAUI Hybrid App

Daniel Kovach 0 Reputation points
2024-04-30T17:24:11.6166667+00:00

I'm porting a project from MVC into a Blazor MAUI Hybrid app with the intent to share common components and data. I have a Razor Class Library which does this, but was wondering if I should also put my SQL Server data access in here as well or keep that in the Blazor web project?

Blazor
Blazor
A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
1,413 questions
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,870 questions
.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
2,967 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Bruce (SqlWork.com) 57,646 Reputation points
    2024-04-30T18:30:11.3766667+00:00

    I would assume a Maui app would call a webapi to do database access (unless it's a local SqlLite database). But even in this case I expect a separate project for the database layer.

    0 comments No comments

  2. Yonglun Liu (Shanghai Wicresoft Co,.Ltd.) 36,951 Reputation points Microsoft Vendor
    2024-05-09T08:37:05.3666667+00:00

    Hello,

    For MAUI blazor applications, the best practices for the application database are no different from MAUI. Therefore, it is recommended that you refer to the following official documentation.

    Best Regards,

    Alec Liu.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments