How mnegah/grpcsampleproject works
This repository implements a person-record CRUD service exposed over gRPC. A client sends one of the defined RPC requests; the registered gRPC handler maps it to application operations, which translate DTOs to domain entities and call the repository; the repository uses Entity Framework to persist or query person records. The graph reflects calls and storage wiring visible in the excerpts. The validator and protocol definitions are present, but their runtime validation use and protocol generation links are not established by the sampled code.
Main entry points: Program.cs Service host · PersonService.cs Person operations · PersonGrpcService .cs Person RPC handler · PersonRepository.cs Person repository
Components 11
gRPC API
- Service host
SimpleCrudWithGRPC/Program.cs - Person RPC handler
SimpleCrudWithGRPC/Services/PersonGrpcService .cs - RPC contract
SimpleCrudWithGRPC/Protos/personproto.proto
Application
- Person operations
SimpleCrudWithGRPC.Application/Services/PersonService.cs - Person DTO
SimpleCrudWithGRPC.Application/DTOs/PersonDto.cs
Person domain
- Person entity
SimpleCrudWithGRPC.Core/Entities/Person.cs - Repository interface
SimpleCrudWithGRPC.Core/IRepositories/IPersonRepository.cs
Persistence
- Person repository
SimpleCrudWithGRPC.Infrastructure/Repositories/PersonRepository.cs - EF context
SimpleCrudWithGRPC.Infrastructure/Data/ApplicationDbContext.cs - Person database
Database/PersonDB.mdf
Other components
- gRPC client
Connections 13
- gRPC client → Service host: sends RPCs
- Service host → Person RPC handler: maps service
SimpleCrudWithGRPC/Program.cs - Service host → EF context: configures context
SimpleCrudWithGRPC/Program.cs - Service host → Person operations: registers service
SimpleCrudWithGRPC/Program.cs - Service host → Person repository: registers repository
SimpleCrudWithGRPC/Program.cs - Person RPC handler → Person operations: calls operations
SimpleCrudWithGRPC/Services/PersonGrpcService .cs - Person RPC handler → Person DTO: maps requests
SimpleCrudWithGRPC/Services/PersonGrpcService .cs - Person operations → Repository interface: calls repository
SimpleCrudWithGRPC.Application/Services/PersonService.cs - Person operations → Person entity: maps entities
SimpleCrudWithGRPC.Application/Services/PersonService.cs - Person operations → Person DTO: maps DTOs
SimpleCrudWithGRPC.Application/Services/PersonService.cs - Person repository → EF context: queries and saves
SimpleCrudWithGRPC.Infrastructure/Repositories/PersonRepository.cs - Person repository → Person entity: reads and writes
SimpleCrudWithGRPC.Infrastructure/Repositories/PersonRepository.cs - EF context → Person database: stores records