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

더 자세히 ...

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

Public 멤버 함수

 JsonProjectStore (PortfolioOptions opts)
async Task< List< ProjectItem > > GetAllAsync (string slug)
async Task< ProjectItem?> GetAsync (string slug, string projectId)
async Task SaveAsync (string slug, ProjectItem item)
Task DeleteAsync (string slug, string projectId)

Private 멤버 함수

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

Private 속성

readonly string _root

정적 Private 속성

static readonly JsonSerializerOptions _json

상세한 설명

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

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

생성자 & 소멸자 문서화

◆ JsonProjectStore()

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

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

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

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

57=> _root = opts.ResolvedDataPath;

다음을 참조함 : _root.

멤버 함수 문서화

◆ DeleteAsync()

Task PortfolioApp.Services.JsonProjectStore.DeleteAsync ( string slug,
string projectId )
inline

Delete Async 작업을 수행합니다.

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

PortfolioApp.Services.IProjectStore를 구현.

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

273 {
274 var path = Path_(slug, projectId);
275 if (File.Exists(path)) File.Delete(path);
276 var mediaDir = System.IO.Path.Combine(_root, slug, "media", projectId);
277 if (Directory.Exists(mediaDir)) Directory.Delete(mediaDir, true);
278 return Task.CompletedTask;
279 }

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

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

◆ Dir()

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

Dir 작업을 수행합니다.

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

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

83=> Path.Combine(_root, slug, "projects");

다음을 참조함 : _root.

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

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

◆ GetAllAsync()

async Task< List< ProjectItem > > PortfolioApp.Services.JsonProjectStore.GetAllAsync ( string slug)
inline

All Async 값을 가져옵니다.

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

PortfolioApp.Services.IProjectStore를 구현.

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

143 {
144 var dir = Dir(slug);
145 if (!Directory.Exists(dir)) return [];
146 var list = new List<ProjectItem>();
147 foreach (var f in Directory.GetFiles(dir, "*.json"))
148 {
149 try
150 {
151 var json = await File.ReadAllTextAsync(f);
152 var item = JsonSerializer.Deserialize<ProjectItem>(json, _json);
153 if (item != null) list.Add(item);
154 }
155 catch { }
156 }
157 return [.. list.OrderBy(p => p.SortOrder == 0 ? int.MaxValue : p.SortOrder)
158 .ThenByDescending(p => p.Year)];
159 }

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

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

◆ GetAsync()

async Task< ProjectItem?> PortfolioApp.Services.JsonProjectStore.GetAsync ( string slug,
string projectId )
inline

Async 값을 가져옵니다.

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

PortfolioApp.Services.IProjectStore를 구현.

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

194 {
195 var path = Path_(slug, projectId);
196 if (!File.Exists(path)) return null;
197 var json = await File.ReadAllTextAsync(path);
198 return JsonSerializer.Deserialize<ProjectItem>(json, _json);
199 }

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

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

◆ Path_()

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

Path 작업을 수행합니다.

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

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

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

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

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

◆ SaveAsync()

async Task PortfolioApp.Services.JsonProjectStore.SaveAsync ( string slug,
ProjectItem item )
inline

Async 데이터를 저장합니다.

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

PortfolioApp.Services.IProjectStore를 구현.

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

234 {
235 Directory.CreateDirectory(Dir(slug));
236 var json = JsonSerializer.Serialize(item, _json);
237 await File.WriteAllTextAsync(Path_(slug, item.Id), json);
238 }

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

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

멤버 데이터 문서화

◆ _json

readonly JsonSerializerOptions PortfolioApp.Services.JsonProjectStore._json
staticprivate
초기값:
= new()
{
WriteIndented = true,
Converters = { new JsonStringEnumConverter() }
}

json 값을 보관합니다.

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

36 {
37 WriteIndented = true,
38 Converters = { new JsonStringEnumConverter() }
39 };

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

◆ _root

readonly string PortfolioApp.Services.JsonProjectStore._root
private

root 값을 보관합니다.

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

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


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