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

더 자세히 ...

Public 멤버 함수

 ShopCustomerProfileStore (ShopOptions options)
async Task< ShopCustomerProfile?> GetAsync (string slug, string userId)
async Task SaveAsync (string slug, ShopCustomerProfile profile)

Private 멤버 함수

async Task< List< ShopCustomerProfile > > LoadAsync (string slug)
string ShopDir (string slug)
string ProfilePath (string slug)

Private 속성

readonly string _root

정적 Private 속성

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

상세한 설명

Shop Customer Profile Store 기능과 관련 상태를 캡슐화합니다.

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

생성자 & 소멸자 문서화

◆ ShopCustomerProfileStore()

ShopPlatform.Services.ShopCustomerProfileStore.ShopCustomerProfileStore ( ShopOptions options)
inline

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

매개변수
options동작을 구성하는 설정입니다.

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

52 {
53 _root = options.ResolvedDataPath;
54 }

다음을 참조함 : _root, ShopPlatform.Models.ShopOptions.ResolvedDataPath.

멤버 함수 문서화

◆ GetAsync()

async Task< ShopCustomerProfile?> ShopPlatform.Services.ShopCustomerProfileStore.GetAsync ( string slug,
string userId )
inline

Async 값을 가져옵니다.

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

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

89 {
90 var profiles = await LoadAsync(slug).ConfigureAwait(false);
91 return profiles.FirstOrDefault(x => string.Equals(x.UserId, userId, StringComparison.Ordinal));
92 }

다음을 참조함 : LoadAsync().

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

◆ LoadAsync()

async Task< List< ShopCustomerProfile > > ShopPlatform.Services.ShopCustomerProfileStore.LoadAsync ( string slug)
inlineprivate

Async 데이터를 불러옵니다.

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

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

170 {
171 var path = ProfilePath(slug);
172 if (!File.Exists(path))
173 {
174 return [];
175 }
176
177 await using var stream = File.OpenRead(path);
178 return await JsonSerializer.DeserializeAsync<List<ShopCustomerProfile>>(stream, JsonOptions).ConfigureAwait(false) ?? [];
179 }

다음을 참조함 : JsonOptions, ProfilePath().

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

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

◆ ProfilePath()

string ShopPlatform.Services.ShopCustomerProfileStore.ProfilePath ( string slug)
inlineprivate

Profile Path 작업을 수행합니다.

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

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

230=> Path.Combine(ShopDir(slug), "customers.json");

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

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

◆ SaveAsync()

async Task ShopPlatform.Services.ShopCustomerProfileStore.SaveAsync ( string slug,
ShopCustomerProfile profile )
inline

Async 데이터를 저장합니다.

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

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

127 {
128 var profiles = await LoadAsync(slug).ConfigureAwait(false);
129 var index = profiles.FindIndex(x => string.Equals(x.UserId, profile.UserId, StringComparison.Ordinal));
130 profile.UpdatedAt = DateTime.UtcNow;
131
132 if (index >= 0)
133 {
134 profiles[index] = profile;
135 }
136 else
137 {
138 profiles.Add(profile);
139 }
140
141 Directory.CreateDirectory(ShopDir(slug));
142 await File.WriteAllTextAsync(ProfilePath(slug), JsonSerializer.Serialize(profiles, JsonOptions)).ConfigureAwait(false);
143 }

다음을 참조함 : JsonOptions, LoadAsync(), ProfilePath(), ShopDir(), ShopPlatform.Models.ShopCustomerProfile.UserId.

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

◆ ShopDir()

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

Shop Dir 작업을 수행합니다.

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

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

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

다음을 참조함 : _root.

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

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

멤버 데이터 문서화

◆ _root

readonly string ShopPlatform.Services.ShopCustomerProfileStore._root
private

root 값을 보관합니다.

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

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

◆ JsonOptions

readonly JsonSerializerOptions ShopPlatform.Services.ShopCustomerProfileStore.JsonOptions = new() { WriteIndented = true }
staticprivate

Json Options 값을 보관합니다.

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

33{ WriteIndented = true };

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


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