Skip to content

Карпачева Полина Лаб. 1 Группа 6512#19

Open
PolinaKrp wants to merge 4 commits intoitsecd:mainfrom
PolinaKrp:main
Open

Карпачева Полина Лаб. 1 Группа 6512#19
PolinaKrp wants to merge 4 commits intoitsecd:mainfrom
PolinaKrp:main

Conversation

@PolinaKrp
Copy link

ФИО: Карпачева Полина
Номер группы: 6512
Номер лабораторной: 1
Номер варианта: 22
Краткое описание предметной области: Товар на складе
Краткое описание добавленных фич: Добавлен сервис генерации и кэширование

image image

@github-actions github-actions bot added In progress Код в процессе проверки Lab 1 Лабораторная №1. Кэширование labels Feb 27, 2026
@github-actions github-actions bot requested a review from Gwymlas February 27, 2026 07:39
Comment on lines +1 to +3
using System;
namespace AspireApp.ApiService.Properties.Entities;
using System.Text.Json.Serialization;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Сначала using, потом namespace

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Папки 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);
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Вынести в отдельный файл

Comment on lines +28 to +32
public WarehouseCache(IDistributedCache cache, ILogger<WarehouseCache> logger)
{
_cache = cache;
_logger = logger;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Использовать праймари конструктор

/// <summary>
/// Генерация нескольких случайных товаров
/// </summary>
public List<Warehouse> Generate(int count) => _faker.Generate(count);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Этот метод нужен?

<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

По заданию

Реализация серверной части на .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>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

После переноса папок эти строки не понадобятся

Comment on lines +19 to +21
<ProjectReference Include="..\AspireApp.Web\AspireApp.Web.csproj">
<ReferenceSourceTarget></ReferenceSourceTarget>
</ProjectReference>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Удалить

Comment on lines +11 to +13
<ItemGroup>
<PackageReference Include="Aspire.Hosting.Redis" Version="9.5.0" />
</ItemGroup>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Версия aspire sdk и пакетов разные

builder.AddRedisDistributedCache("RedisCache");

builder.Services.AddScoped<IWarehouseCache, WarehouseCache>();
builder.Services.AddScoped<WarehouseGenerator>();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WarehouseGenerator можно зарегистрировать как Singleton- он никакого состояния не хранит, его методы не зависят от внешних данных, конструктор выполняет разовые настройки правил генерации

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

In progress Код в процессе проверки Lab 1 Лабораторная №1. Кэширование

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants