简体   繁体   English

如何创建连接到具有 CRUD 功能的数据库的 Blazor WebAssembly 网站

[英]How do you create a Blazor WebAssembly website connected to a database with CRUD functions

I am trying to get deeper into blazor.我正在尝试更深入地了解 blazor。 I want to build a website that can use CRUD functions connected to a database.我想建立一个可以使用连接到数据库的 CRUD 函数的网站。 I use Microsoft SQL Server along with Microsoft SQL Server Management Studio and Visual Studio 2019 on .Net Core/ASP.NET CORE 5.我在 .Net Core/ASP.NET CORE 5 上使用 Microsoft SQL Server 以及 Microsoft SQL Server Management Studio 和 Visual Studio 2019。

You don't, is the simple answer.你不,是简单的答案。 Blazor WebAssembly is still website running in a browser and hence has very limited access to the client machine. Blazor WebAssembly 仍然是在浏览器中运行的网站,因此对客户端计算机的访问非常有限。

To do this you have two layers, the website in Blazor WASM, which calls WebAPI's on another layer (a basic ASPNET Core WebAPI).为此,您有两层,Blazor WASM 中的网站,它在另一层(基本的 ASPNET Core WebAPI)上调用 WebAPI。 This API layer, as its sits on your server, can access databases and other resources.这个 API 层位于您的服务器上,可以访问数据库和其他资源。 Blazor WASM is no different to Angular, Vue or React in this way. Blazor WASM 在这方面与 Angular、Vue 或 React 没有什么不同。

Another alternative is Blazor Server, as in effect everything is running on your server and not the client.另一种选择是 Blazor 服务器,因为实际上一切都在您的服务器上运行,而不是在客户端上运行。

Here is a sample project of a Blazor WebAsm solution that implements CRUD for a database accessed via EF Core.这是 Blazor WebAsm 解决方案的示例项目,该解决方案为通过 EF Core 访问的数据库实现 CRUD。 It's based on EasyData open-source library.它基于 EasyData 开源库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将 Blazor WebAssembly 连接到数据库 - How to connect Blazor WebAssembly to DataBase 如何告诉 Blazor Webassembly 网站的访问者他们的浏览器不支持 Webassembly? - How to tell visitors of a Blazor Webassembly website that their browser doesn't support Webassembly? 如何使用Windows窗体在数据库上执行基本CRUD? - How do you perform basic CRUD on a database using windows forms? 如何在 C# Blazor WebAssembly 中使用引导图标? - How do I use Bootstrap Icons in C# Blazor WebAssembly? 我可以创建一个从本地 SQL DB 读取但不需要在线托管的 CRUD blazor webassembly 应用程序吗? - Can I create a CRUD blazor webassembly app that reads from a local SQL DB but doesn't need to be hosted online? 如何使用 Blazor 创建表单向导? - How do you create a form wizard using Blazor? 您如何本地化数据库驱动的网站 - How do you localize a database driven website 如何访问 blazor webassembly 中的应用程序设置 - How to acess the appsettings in blazor webassembly 如何将 Blazor Serverside 与 Blazor WebAssembly 结合使用? - How to use Blazor Serverside with Blazor WebAssembly? 如何在客户端(blazor webassembly)调用create webapi(blazor server app) - how to call create webapi(blazor server app) in client side(blazor webassembly)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM