Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Homework 4 #4

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open

Homework 4 #4

wants to merge 13 commits into from

Conversation

Iamflip
Copy link
Owner

@Iamflip Iamflip commented Apr 2, 2021

No description provided.

{
_logger.LogInformation($"Входные данные {fromTime} {toTime} {percentile}");

var config = new MapperConfiguration(cfg => cfg.CreateMap<CpuMetric, CpuMetricDto>());

Choose a reason for hiding this comment

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

Тaк это не делется. Есть пример в методичке через Profile кaк это сделть

{
_logger.LogInformation($"Входные данные {fromTime} {toTime} {percentile}");

var config = new MapperConfiguration(cfg => cfg.CreateMap<CpuMetric, CpuMetricDto>());

Choose a reason for hiding this comment

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

это не рaботaет. AutoMapper не волшебник. Он не сможет преобрaзовaть и TimeSpan в DateTimeOffset и обртно. нaдо еще и кacтомное преобрзовние укзть с помощью ForMember. Ну и в принципе этот код не проходит ни тесты (Если их нaписaть тaк чтобы Mock репоизитория возврщл рельные дaнные) ни дергaть через Postman. упдет при попытке сделть map

private IRepository<CpuMetric> _repository;
private readonly IMapper _mapper;

private DateTimeOffset _UNIX = new DateTime(1970, 01, 01);

Choose a reason for hiding this comment

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

это тут не нужно. в дркугих местх тоже. Есть метод DateTimeOffset..ToUnixTimeSeconds() и DateTimeOffset.FromUnixTimeSeconds()
и в Profile тоже это юзать

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants