Open
Conversation
Gwymlas
requested changes
Feb 28, 2026
Comment on lines
+1
to
+3
| using System; | ||
| namespace AspireApp.ApiService.Properties.Entities; | ||
| using System.Text.Json.Serialization; |
There was a problem hiding this comment.
Папки Entities и Generator вынести из Properties
Comment on lines
+11
to
+18
| public interface IWarehouseCache | ||
| { | ||
| /// <summary>Получить товар из кэша по идентификатору</summary> | ||
| Task<Warehouse?> GetAsync(int id); | ||
|
|
||
| /// <summary>Сохранить товар в кэш с временем</summary> | ||
| Task SetAsync(Warehouse warehouse, TimeSpan expiration); | ||
| } |
Comment on lines
+28
to
+32
| public WarehouseCache(IDistributedCache cache, ILogger<WarehouseCache> logger) | ||
| { | ||
| _cache = cache; | ||
| _logger = logger; | ||
| } |
| /// <summary> | ||
| /// Генерация нескольких случайных товаров | ||
| /// </summary> | ||
| public List<Warehouse> Generate(int count) => _faker.Generate(count); |
| <Project Sdk="Microsoft.NET.Sdk.Web"> | ||
|
|
||
| <PropertyGroup> | ||
| <TargetFramework>net10.0</TargetFramework> |
There was a problem hiding this comment.
По заданию
Реализация серверной части на .NET 8.
Comment on lines
+26
to
+33
| <ItemGroup> | ||
| <None Remove="Properties\Entities\" /> | ||
| <None Remove="Properties\Generator\" /> | ||
| </ItemGroup> | ||
| <ItemGroup> | ||
| <Folder Include="Properties\Entities\" /> | ||
| <Folder Include="Properties\Generator\" /> | ||
| </ItemGroup> |
There was a problem hiding this comment.
После переноса папок эти строки не понадобятся
Comment on lines
+19
to
+21
| <ProjectReference Include="..\AspireApp.Web\AspireApp.Web.csproj"> | ||
| <ReferenceSourceTarget></ReferenceSourceTarget> | ||
| </ProjectReference> |
Comment on lines
+11
to
+13
| <ItemGroup> | ||
| <PackageReference Include="Aspire.Hosting.Redis" Version="9.5.0" /> | ||
| </ItemGroup> |
| builder.AddRedisDistributedCache("RedisCache"); | ||
|
|
||
| builder.Services.AddScoped<IWarehouseCache, WarehouseCache>(); | ||
| builder.Services.AddScoped<WarehouseGenerator>(); |
There was a problem hiding this comment.
WarehouseGenerator можно зарегистрировать как Singleton- он никакого состояния не хранит, его методы не зависят от внешних данных, конструктор выполняет разовые настройки правил генерации
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ФИО: Карпачева Полина
Номер группы: 6512
Номер лабораторной: 1
Номер варианта: 22
Краткое описание предметной области: Товар на складе
Краткое описание добавленных фич: Добавлен сервис генерации и кэширование