ShopPlatform.Web 1.0.0.0
농산물, 소프트웨어 라이선스와 개발 용역을 직접 판매하는 CodeMaru 직영 쇼핑몰입니다.
로딩중...
검색중...
일치하는것 없음
ShopPlatform.Services.JsonShopTenantStore 클래스 참조sealed

더 자세히 ...

ShopPlatform.Services.JsonShopTenantStore에 대한 상속 다이어그램 :
ShopPlatform.Services.JsonShopTenantStore에 대한 협력 다이어그램:

Public 멤버 함수

 JsonShopTenantStore (ShopOptions opts)
async Task< ShopConfig?> GetAsync (string slug)
async Task< IReadOnlyList< ShopConfig > > GetAllAsync ()
async Task SaveAsync (ShopConfig config)
Task DeleteAsync (string slug)
Task< bool > ExistsAsync (string slug)

Private 멤버 함수

string ShopDir (string slug)
string ConfigPath (string slug)

Private 속성

readonly string _root

정적 Private 속성

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

상세한 설명

파일시스템 기반 테넌트 스토어. App_Data/Shops/{slug}/config.json.

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

생성자 & 소멸자 문서화

◆ JsonShopTenantStore()

ShopPlatform.Services.JsonShopTenantStore.JsonShopTenantStore ( ShopOptions opts)
inline

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

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

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

51=> _root = opts.ResolvedDataPath;

다음을 참조함 : _root.

멤버 함수 문서화

◆ ConfigPath()

string ShopPlatform.Services.JsonShopTenantStore.ConfigPath ( string slug)
inlineprivate

Config Path 작업을 수행합니다.

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

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

255=> Path.Combine(ShopDir(slug), "config.json");

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

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

◆ DeleteAsync()

Task ShopPlatform.Services.JsonShopTenantStore.DeleteAsync ( string slug)
inline

Delete Async 작업을 수행합니다.

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

ShopPlatform.Services.IShopTenantStore를 구현.

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

173 {
174 var dir = ShopDir(slug);
175 if (Directory.Exists(dir)) Directory.Delete(dir, recursive: true);
176 return Task.CompletedTask;
177 }

다음을 참조함 : ShopDir().

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

◆ ExistsAsync()

Task< bool > ShopPlatform.Services.JsonShopTenantStore.ExistsAsync ( string slug)
inline

Exists Async 작업을 수행합니다.

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

ShopPlatform.Services.IShopTenantStore를 구현.

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

203 =>
204 Task.FromResult(File.Exists(ConfigPath(slug)));

다음을 참조함 : ConfigPath().

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

◆ GetAllAsync()

async Task< IReadOnlyList< ShopConfig > > ShopPlatform.Services.JsonShopTenantStore.GetAllAsync ( )
inline

All Async 값을 가져옵니다.

반환값
Get All Async 작업에서 생성한 Task<IReadOnlyList<ShopConfig>> 결과입니다.

ShopPlatform.Services.IShopTenantStore를 구현.

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

102 {
103 if (!Directory.Exists(_root)) return Array.Empty<ShopConfig>();
104 var list = new List<ShopConfig>();
105 foreach (var dir in Directory.EnumerateDirectories(_root))
106 {
107 var path = Path.Combine(dir, "config.json");
108 if (!File.Exists(path)) continue;
109 await using var stream = File.OpenRead(path);
110 var cfg = await JsonSerializer.DeserializeAsync<ShopConfig>(stream, _json);
111 if (cfg != null) list.Add(cfg);
112 }
113 return list;
114 }

다음을 참조함 : _json, _root.

◆ GetAsync()

async Task< ShopConfig?> ShopPlatform.Services.JsonShopTenantStore.GetAsync ( string slug)
inline

Async 값을 가져옵니다.

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

ShopPlatform.Services.IShopTenantStore를 구현.

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

78 {
79 var path = ConfigPath(slug);
80 if (!File.Exists(path)) return null;
81 await using var stream = File.OpenRead(path);
82 return await JsonSerializer.DeserializeAsync<ShopConfig>(stream, _json);
83 }

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

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

◆ SaveAsync()

async Task ShopPlatform.Services.JsonShopTenantStore.SaveAsync ( ShopConfig config)
inline

Async 데이터를 저장합니다.

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

ShopPlatform.Services.IShopTenantStore를 구현.

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

141 {
142 var dir = ShopDir(config.Slug);
143 Directory.CreateDirectory(dir);
144 var json = JsonSerializer.Serialize(config, _json);
145 await File.WriteAllTextAsync(ConfigPath(config.Slug), json);
146 }

다음을 참조함 : _json, ConfigPath(), ShopDir(), ShopPlatform.Models.ShopConfig.Slug.

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

◆ ShopDir()

string ShopPlatform.Services.JsonShopTenantStore.ShopDir ( string slug)
inlineprivate

Shop Dir 작업을 수행합니다.

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

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

230=> Path.Combine(_root, slug);

다음을 참조함 : _root.

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

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

멤버 데이터 문서화

◆ _json

readonly JsonSerializerOptions ShopPlatform.Services.JsonShopTenantStore._json = new() { WriteIndented = true }
staticprivate

json 값을 보관합니다.

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

33{ WriteIndented = true };

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

◆ _root

readonly string ShopPlatform.Services.JsonShopTenantStore._root
private

root 값을 보관합니다.

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

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


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