Portfolio.Web 1.0.0.0
.NET, Blazor, WPF와 서비스 운영 경험을 프로젝트·이력·기술 스택 단위로 보여주는 개발자 포트폴리오입니다.
로딩중...
검색중...
일치하는것 없음
PortfolioApp.Services.JsonContactStore 클래스 참조

더 자세히 ...

PortfolioApp.Services.JsonContactStore에 대한 상속 다이어그램 :
PortfolioApp.Services.JsonContactStore에 대한 협력 다이어그램:

Public 멤버 함수

 JsonContactStore (PortfolioOptions opts)
async Task< List< ContactMessage > > GetAllAsync (string slug)
async Task SaveAsync (string slug, ContactMessage msg)
Task DeleteAsync (string slug, string msgId)
async Task MarkReadAsync (string slug, string msgId)

Private 멤버 함수

string Dir (string slug)
string Path_ (string slug, string id)

Private 속성

readonly string _root

정적 Private 속성

static readonly JsonSerializerOptions _json = new() { WriteIndented = true }

상세한 설명

Json Contact Store 기능과 관련 상태를 캡슐화합니다.

JsonContactStore.cs 파일의 15 번째 라인에서 정의되었습니다.

생성자 & 소멸자 문서화

◆ JsonContactStore()

PortfolioApp.Services.JsonContactStore.JsonContactStore ( PortfolioOptions opts)
inline

지정한 설정으로 JsonContactStore 클래스의 새 인스턴스를 초기화합니다.

매개변수
optsopts에 사용할 PortfolioOptions 값입니다.

JsonContactStore.cs 파일의 52 번째 라인에서 정의되었습니다.

52=> _root = opts.ResolvedDataPath;

다음을 참조함 : _root.

멤버 함수 문서화

◆ DeleteAsync()

Task PortfolioApp.Services.JsonContactStore.DeleteAsync ( string slug,
string msgId )
inline

Delete Async 작업을 수행합니다.

매개변수
slugslug에 사용할 string 값입니다.
msgIdmsg Id에 사용할 string 값입니다.
반환값
Delete Async 작업에서 생성한 Task 결과입니다.

PortfolioApp.Services.IContactStore를 구현.

JsonContactStore.cs 파일의 226 번째 라인에서 정의되었습니다.

227 {
228 var path = Path_(slug, msgId);
229 if (File.Exists(path)) File.Delete(path);
230 return Task.CompletedTask;
231 }

다음을 참조함 : Path_().

이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:

◆ Dir()

string PortfolioApp.Services.JsonContactStore.Dir ( string slug)
inlineprivate

Dir 작업을 수행합니다.

매개변수
slugslug에 사용할 string 값입니다.
반환값
Dir 작업에서 생성한 string 결과입니다.

JsonContactStore.cs 파일의 78 번째 라인에서 정의되었습니다.

78=> Path.Combine(_root, slug, "contacts");

다음을 참조함 : _root.

다음에 의해서 참조됨 : GetAllAsync(), SaveAsync().

이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ GetAllAsync()

async Task< List< ContactMessage > > PortfolioApp.Services.JsonContactStore.GetAllAsync ( string slug)
inline

All Async 값을 가져옵니다.

매개변수
slugslug에 사용할 string 값입니다.
반환값
Get All Async 작업에서 생성한 Task<List<ContactMessage>> 결과입니다.

PortfolioApp.Services.IContactStore를 구현.

JsonContactStore.cs 파일의 137 번째 라인에서 정의되었습니다.

138 {
139 var dir = Dir(slug);
140 if (!Directory.Exists(dir)) return [];
141 var list = new List<ContactMessage>();
142 foreach (var f in Directory.GetFiles(dir, "*.json"))
143 {
144 try
145 {
146 var json = await File.ReadAllTextAsync(f);
147 var msg = JsonSerializer.Deserialize<ContactMessage>(json);
148 if (msg != null) list.Add(msg);
149 }
150 catch { }
151 }
152 return [.. list.OrderByDescending(m => m.SentAt)];
153 }

다음을 참조함 : Dir().

이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:

◆ MarkReadAsync()

async Task PortfolioApp.Services.JsonContactStore.MarkReadAsync ( string slug,
string msgId )
inline

Mark Read Async 작업을 수행합니다.

매개변수
slugslug에 사용할 string 값입니다.
msgIdmsg Id에 사용할 string 값입니다.
반환값
Mark Read Async 작업에서 생성한 Task 결과입니다.

PortfolioApp.Services.IContactStore를 구현.

JsonContactStore.cs 파일의 265 번째 라인에서 정의되었습니다.

266 {
267 var path = Path_(slug, msgId);
268 if (!File.Exists(path)) return;
269 var json = await File.ReadAllTextAsync(path);
270 var msg = JsonSerializer.Deserialize<ContactMessage>(json);
271 if (msg is null) return;
272 msg.IsRead = true;
273 await File.WriteAllTextAsync(path, JsonSerializer.Serialize(msg, _json));
274 }

다음을 참조함 : _json, Path_().

이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:

◆ Path_()

string PortfolioApp.Services.JsonContactStore.Path_ ( string slug,
string id )
inlineprivate

Path 작업을 수행합니다.

매개변수
slugslug에 사용할 string 값입니다.
idid에 사용할 string 값입니다.
반환값
Path 작업에서 생성한 string 결과입니다.

JsonContactStore.cs 파일의 111 번째 라인에서 정의되었습니다.

111=> Path.Combine(Dir(slug), $"{id}.json");

다음에 의해서 참조됨 : DeleteAsync(), MarkReadAsync(), SaveAsync().

이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ SaveAsync()

async Task PortfolioApp.Services.JsonContactStore.SaveAsync ( string slug,
ContactMessage msg )
inline

Async 데이터를 저장합니다.

매개변수
slugslug에 사용할 string 값입니다.
msgmsg에 사용할 ContactMessage 값입니다.
반환값
Save Async 작업에서 생성한 Task 결과입니다.

PortfolioApp.Services.IContactStore를 구현.

JsonContactStore.cs 파일의 187 번째 라인에서 정의되었습니다.

188 {
189 Directory.CreateDirectory(Dir(slug));
190 var json = JsonSerializer.Serialize(msg, _json);
191 await File.WriteAllTextAsync(Path_(slug, msg.Id), json);
192 }

다음을 참조함 : _json, Dir(), PortfolioApp.Models.ContactMessage.Id, Path_().

이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:

멤버 데이터 문서화

◆ _json

readonly JsonSerializerOptions PortfolioApp.Services.JsonContactStore._json = new() { WriteIndented = true }
staticprivate

json 값을 보관합니다.

JsonContactStore.cs 파일의 34 번째 라인에서 정의되었습니다.

34{ WriteIndented = true };

다음에 의해서 참조됨 : MarkReadAsync(), SaveAsync().

◆ _root

readonly string PortfolioApp.Services.JsonContactStore._root
private

root 값을 보관합니다.

JsonContactStore.cs 파일의 25 번째 라인에서 정의되었습니다.

다음에 의해서 참조됨 : Dir(), JsonContactStore().


이 클래스에 대한 문서화 페이지는 다음의 파일로부터 생성되었습니다.: