# EasySQLite学习 **Repository Path**: vopipi/easy-sqlite ## Basic Information - **Project Name**: EasySQLite学习 - **Description**: 一个基于 .NET9 的轻量级 SQLite 数据库操作示例项目 - **Primary Language**: C# - **License**: MulanPSL-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-09-30 - **Last Updated**: 2026-09-30 ## Categories & Tags **Categories**: Uncategorized **Tags**: Csharp, Sqlite, dotNET, NET9 ## README # Easy-SQLite A lightweight SQLite database operation example project based on .NET, including a WebAPI backend service and a Blazor WebAssembly frontend interface. ## Project Introduction Easy-SQLite is a complete full-stack example project demonstrating how to build a student management system using ASP.NET Core + Blazor WebAssembly + SQLite. The project encapsulates concise SQLite operation utility classes, supporting both synchronous and asynchronous methods for database CRUD operations. ## Tech Stack - **Backend Framework**: ASP.NET Core 8.0/9.0 - **Frontend Framework**: Blazor WebAssembly - **Database**: SQLite (using sqlite-net library) - **UI Component Library**: BootstrapBlazor - **Object Mapping**: AutoMapper - **API Documentation**: Swagger/OpenAPI ## Project Structure ``` EasySQLite/ ├── Entity/ # Entity Layer - Data Model Definitions │ ├── Student.cs # Student Entity │ ├── SchoolClass.cs # Class Entity │ ├── ApiResponse.cs # Unified Response Result │ └── ViewModel/ # View Models ├── Utility/ # Utility Layer - General Helper Classes │ ├── SQLiteHelper.cs # SQLite Synchronous Operation Helper │ ├── SQLiteAsyncHelper.cs # SQLite Asynchronous Operation Helper │ └── ReflectionHelper.cs # Reflection Helper ├── WebApi/ # WebAPI Project - Backend Service │ ├── Controllers/ # API Controllers │ └── SwaggerSetUp.cs # Swagger Configuration └── WebUI/ # Blazor WebAssembly Project - Frontend Interface ├── Pages/ # Page Components └── Services/ # Business Services ``` ## Features ### Backend API - **Student Management**: Create, Read, Update, Delete student information - **Class Management**: Create, Read, Update, Delete class information - **Related Queries**: Automatically associate class names when querying students ### Frontend Features - Student list display (supports pagination) - Student add/edit - Student delete - Class information management ## Quick Start ### Environment Requirements - .NET 8.0 or .NET 9.0 SDK - Visual Studio 2022 or VS Code ### Running the Project 1. Clone the project ```bash git clone https://gitee.com/vopipi/easy-sqlite.git ``` 2. Open the solution ```bash cd EasySQLite dotnet sln add EasySQLite.sln ``` 3. Start the WebAPI project ```bash cd WebApi dotnet run ``` 4. Start the WebUI project (open another terminal) ```bash cd WebUI dotnet run ``` ### Access Addresses - WebAPI: `https://localhost:5001` - Swagger Documentation: `https://localhost:5001/swagger` - Blazor UI: `https://localhost:5002` ## API Interface Documentation ### Student Management | Method | Path | Description | |------|------|------| | POST | /api/Student/CreateStudent | Create Student | | GET | /api/Student/GetAllStudent | Get All Students | | GET | /api/Student/GetStudentById/{id} | Get Single Student | | PUT | /api/Student/UpdateStudent/{id} | Update Student | | DELETE | /api/Student/DeleteStudent/{id} | Delete Student | ### Class Management | Method | Path | Description | |------|------|------| | POST | /api/SchoolClass/CreateClass | Create Class | | GET | /api/SchoolClass/GetAllClass | Get All Classes | | GET | /api/SchoolClass/GetClass/{id} | Get Single Class | | PUT | /api/SchoolClass/UpdateClass/{id} | Update Class | | DELETE | /api/SchoolClass/DeleteClass/{id} | Delete Class | ## SQLite Operation Examples ### Synchronous Operation ```csharp var helper = new SQLiteHelper(); // Insert var id = helper.Insert(new Student { Name = "Zhang San", Age = 20 }); // Query var students = helper.Query(s => s.Age > 18); // Update helper.Update(student); // Delete helper.Delete(id); ``` ### Asynchronous Operation ```csharp var asyncHelper = new SQLiteAsyncHelper(); // Insert await asyncHelper.InsertAsync(new Student { Name = "Li Si", Age = 21 }); // Query var students = await asyncHelper.QueryAsync(s => s.Age > 18); ``` ## License MIT License