añade automapper
This commit is contained in:
20
back/Infrastructure/AutoMapperProfile.cs
Normal file
20
back/Infrastructure/AutoMapperProfile.cs
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
|
||||||
|
namespace back.Infrastructure;
|
||||||
|
|
||||||
|
public class AutoMapperProfile : Profile
|
||||||
|
{
|
||||||
|
public AutoMapperProfile()
|
||||||
|
{
|
||||||
|
//CreateMap<Users, User>()
|
||||||
|
// .ForMember(dest => dest.UserId, opt => opt.MapFrom(src => src.UserId))
|
||||||
|
// .ForMember(dest => dest.FirstName, opt => opt.MapFrom(src => src.FirstName))
|
||||||
|
// .ForMember(dest => dest.LastName, opt => opt.MapFrom(src => src.LastName))
|
||||||
|
// .ForMember(dest => dest.Email, opt => opt.MapFrom(src => src.Email))
|
||||||
|
// .ForMember(dest => dest.BirthYear, opt => opt.MapFrom(src => src.Birthday.Year))
|
||||||
|
// .ForMember(dest => dest.BirthMonth, opt => opt.MapFrom(src => src.Birthday.Month))
|
||||||
|
// .ForMember(dest => dest.BirthDay, opt => opt.MapFrom(src => src.Birthday.Day))
|
||||||
|
// .ForMember(dest => dest.OccupationName, opt => opt.Ignore())
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@@ -1,5 +1,7 @@
|
|||||||
using Autofac.Extensions.DependencyInjection;
|
using Autofac.Extensions.DependencyInjection;
|
||||||
|
using AutoMapper;
|
||||||
using back.Domain;
|
using back.Domain;
|
||||||
|
using back.Infrastructure;
|
||||||
using MCVIngenieros.Healthchecks;
|
using MCVIngenieros.Healthchecks;
|
||||||
using MediatR.Extensions.FluentValidation.AspNetCore;
|
using MediatR.Extensions.FluentValidation.AspNetCore;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
@@ -55,6 +57,13 @@ public class Program
|
|||||||
});
|
});
|
||||||
|
|
||||||
builder.Services.AddFluentValidation([typeof(Program).Assembly]);
|
builder.Services.AddFluentValidation([typeof(Program).Assembly]);
|
||||||
|
builder.Services.AddAutoMapper(opts =>
|
||||||
|
{
|
||||||
|
opts.AddProfile<AutoMapperProfile>();
|
||||||
|
opts.AllowNullCollections = true;
|
||||||
|
opts.AllowNullDestinationValues = true;
|
||||||
|
opts.DestinationMemberNamingConvention = new PascalCaseNamingConvention();
|
||||||
|
});
|
||||||
|
|
||||||
builder.Services.AddHealthChecksSupport().DiscoverHealthChecks();
|
builder.Services.AddHealthChecksSupport().DiscoverHealthChecks();
|
||||||
builder.Services.AddLogging();
|
builder.Services.AddLogging();
|
||||||
|
Reference in New Issue
Block a user