BlazorServerWithIdentityTemplate 1.0.2
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package BlazorServerWithIdentityTemplate --version 1.0.2
NuGet\Install-Package BlazorServerWithIdentityTemplate -Version 1.0.2
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="BlazorServerWithIdentityTemplate" Version="1.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="BlazorServerWithIdentityTemplate" Version="1.0.2" />
<PackageReference Include="BlazorServerWithIdentityTemplate" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add BlazorServerWithIdentityTemplate --version 1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: BlazorServerWithIdentityTemplate, 1.0.2"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package BlazorServerWithIdentityTemplate@1.0.2
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=BlazorServerWithIdentityTemplate&version=1.0.2
#tool nuget:?package=BlazorServerWithIdentityTemplate&version=1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Englist& 英文文档
🚀 BlazorServer With Identity 模板 / Template
👋 中文介绍
你好,我是 Ouse,欢迎查看本仓库!
本仓库提供一个 Blazor Server 项目模板,集成了以下功能:
- 🛠 Web API 支持
- 🔐 Identity 认证系统
- 🗄 EF Core(使用 SQLite)
- 🎨 UI 风格使用 MudBlazor
- 🔑 基础登录和登出功能
❓ 为什么需要集成 Web API?
Blazor Server 基于 SignalR 实时通信,所有组件交互都是通过 SignalR 完成,没有传统的 HTTP 请求-响应模式,因此无法直接设置 Cookie,这给登录和登出带来了问题。
解决方案主要有两种:
- 集成 Web API:Blazor Server 通过
NavigationManager或 JS 发起请求,由 API 设置 Cookie。 - 集成 Razor Pages:认证相关页面使用 Razor Pages,Blazor Server 只负责业务界面。
第二种方式不够优雅,并且 Razor Pages 与 Blazor Server 混合会增加项目复杂度,因此模板选择了 第一种方案。
⚡ 中文使用教程
- 打开终端/命令行
- 安装模板:
dotnet new install BlazorServerWithIdentityTemplate
创建新项目:
dotnet new blazorserverwithidentity -n YourProjectName
进入项目目录:
cd YourProjectName
运行项目:
dotnet run
📝 中文其他说明 默认使用 Server 全局交互模式,可根据需求调整。
默认数据库是 SQLite,如果需要使用其它数据库,请修改 ApplicationDbContext 的配置
There are no supported framework assets in this package.
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.