feat : RDB 기능 추가 (라이브러리, base 코드 구현)
This commit is contained in:
73
ReadMe.md
Normal file
73
ReadMe.md
Normal file
@@ -0,0 +1,73 @@
|
||||
# DB 사용법
|
||||
|
||||
## 구조
|
||||
```
|
||||
MMOServer (실행 프로젝트 Test파일들은 임시용)
|
||||
├── RDB/
|
||||
├──── Handlers/
|
||||
│ └──── TestHandler.cs
|
||||
├──── Models/
|
||||
│ └──── TestM.cs
|
||||
├──── Repositories/
|
||||
│ └──── TestRepository.cs
|
||||
└──── Services/
|
||||
└──── TestService.cs
|
||||
|
||||
ServerLib (DLL)
|
||||
├── RDB/
|
||||
├──── Database/
|
||||
│ └── DbConnectionFactory.cs
|
||||
├──── Handlers/
|
||||
│ ├── HandlerHelper.cs
|
||||
│ └── Response.cs
|
||||
└──── Repositories/
|
||||
└── ARepository.cs
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 데이터 흐름
|
||||
|
||||
```
|
||||
호출부 (Packet 등)
|
||||
↓ 파라미터 전달
|
||||
Handler → Service 호출 + 응답 포맷팅 (string)
|
||||
↓
|
||||
Service → 비즈니스 로직, 유효성 검사, 예외 throw
|
||||
↓
|
||||
Repository → DB 접근 (TestM? / bool / long 반환)
|
||||
↓
|
||||
MySQL
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 반환 타입 정리
|
||||
|
||||
| 레이어 | 반환 타입 |
|
||||
|--------|---------------------------------------------------|
|
||||
| Repository | `class?` / `IEnumerable<class>` / `long` / `bool` |
|
||||
| Service | 동일 (그대로 올림) |
|
||||
| Handler | `string` (JSON 포장) |
|
||||
|
||||
---
|
||||
|
||||
## 새 테이블 추가 시
|
||||
|
||||
1. `MMOServer/RDB/Models/` 에 Model 추가
|
||||
2. `MMOServer/RDB/Repositories/` 에 Repository 추가 (ARepository 상속)
|
||||
3. `MMOServer/RDB/Services/` 에 Service 추가
|
||||
4. `MMOServer/RDB/Handlers/` 에 Handler 추가
|
||||
|
||||
**ServerLib (DLL) 은 건드릴 필요 없음.**
|
||||
|
||||
---
|
||||
|
||||
## Connection Pool 설정(아직 구성 안됨)
|
||||
|
||||
```
|
||||
Server=localhost;Database=mydb;User=root;Password=1234;
|
||||
Pooling=true;MinimumPoolSize=5;MaximumPoolSize=100;
|
||||
ConnectionTimeout=30;ConnectionIdleTimeout=180;
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user