допил аттрибутов automap

This commit is contained in:
2025-03-13 09:50:33 +04:00
parent 8bdc9275d5
commit abbfe117f9
4 changed files with 10 additions and 7 deletions

View File

@@ -21,8 +21,7 @@ public ManufacturerStorageContract(SmallSoftwareDbContext dbContext)
_dbContext = dbContext;
var config = new MapperConfiguration(cfg =>
{
cfg.CreateMap<Manufacturer, ManufacturerDataModel>();
cfg.CreateMap<ManufacturerDataModel, Manufacturer>();
cfg.AddMaps(typeof(Manufacturer));
});
_mapper = new Mapper(config);
}

View File

@@ -20,8 +20,7 @@ internal class WorkerStorageContract : IWorkerStorageContract
_dbContext = dbContext;
var config = new MapperConfiguration(cfg =>
{
cfg.CreateMap<Worker, WorkerDataModel>();
cfg.CreateMap<WorkerDataModel, Worker>();
cfg.AddMaps(typeof(Worker).Assembly);
});
_mapper = new Mapper(config);
}

View File

@@ -1,4 +1,6 @@
using System;
using AutoMapper;
using SmallSoftwareContracts.DataModels;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
@@ -7,6 +9,7 @@ using System.Threading.Tasks;
namespace SmallSoftwareDatabase.Models;
[AutoMap(typeof(ManufacturerDataModel), ReverseMap = true)]
internal class Manufacturer
{
public required string Id { get; set; }

View File

@@ -1,4 +1,6 @@
using System;
using AutoMapper;
using SmallSoftwareContracts.DataModels;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
@@ -6,7 +8,7 @@ using System.Text;
using System.Threading.Tasks;
namespace SmallSoftwareDatabase.Models;
[AutoMap(typeof(WorkerDataModel), ReverseMap = true)]
internal class Worker
{
public required string Id { get; set; }