public LiquidService(string connectionString) : base(connectionString) { lineageMapper = new MapperConfiguration(cfg => { cfg.CreateMap <Lineage, LineageDTO>().BeforeMap((l, ldto) => { ldto.ModifiedByClient = IdentityMapper.GetClientById(l.ModifiedBy); ldto.CreatedByClient = IdentityMapper.GetClientById(l.CreatedBy); }); cfg.CreateMap <LineageDTO, Lineage>().BeforeMap((ldto, l) => { l.ModifiedBy = ldto.ModifiedByClient.Id; l.CreatedBy = ldto.CreatedByClient.Id; }); }).CreateMapper(); liquidMapper = new MapperConfiguration(cfg => { cfg.CreateMap <Liquid, LiquidDTO>().BeforeMap((l, ldto) => { ldto.ModifiedByClient = IdentityMapper.GetClientById(l.ModifiedBy); ldto.CreatedByClient = IdentityMapper.GetClientById(l.CreatedBy); ldto.Lineage = lineageMapper.Map <LineageDTO>(Database.Lineages.FindById(l.LineageId)); }); cfg.CreateMap <LiquidDTO, Liquid>().BeforeMap((ldto, l) => { l.ModifiedBy = ldto.ModifiedByClient.Id; l.CreatedBy = ldto.CreatedByClient.Id; l.LineageId = ldto.Lineage.Id; }); }).CreateMapper(); }
public ProducerService(string connectionString) : base(connectionString) { producerMapper = new MapperConfiguration(cfg => { cfg.CreateMap <Producer, ProducerDTO>().AfterMap((p, pdto) => { pdto.ModifiedByClient = IdentityMapper.GetClientById(p.ModifiedBy); pdto.CreatedByClient = IdentityMapper.GetClientById(p.CreatedBy); }); cfg.CreateMap <ProducerDTO, Producer>().AfterMap((pdto, p) => { p.ModifiedBy = pdto.ModifiedByClient.Id; p.CreatedBy = pdto.CreatedByClient.Id; }); }).CreateMapper(); }
public ComponentTypeService(string connectionString) : base(connectionString) { componentTypeMapper = new MapperConfiguration(cfg => { cfg.CreateMap <ComponentType, ComponentTypeDTO>().AfterMap((c, cdto) => { cdto.ModifiedByClient = IdentityMapper.GetClientById(c.ModifiedBy); cdto.CreatedByClient = IdentityMapper.GetClientById(c.CreatedBy); }); cfg.CreateMap <ComponentTypeDTO, ComponentType>().AfterMap((cdto, c) => { c.ModifiedBy = cdto.ModifiedByClient.Id; c.CreatedBy = cdto.CreatedByClient.Id; }); }).CreateMapper(); }
public LiquidComponentService(string connection) : base(connection) { componentTypeMapper = new MapperConfiguration(cfg => { cfg.CreateMap <ComponentType, ComponentTypeDTO>().AfterMap((c, cdto) => { cdto.ModifiedByClient = IdentityMapper.GetClientById(c.ModifiedBy); cdto.CreatedByClient = IdentityMapper.GetClientById(c.CreatedBy); }); cfg.CreateMap <ComponentTypeDTO, ComponentType>().AfterMap((cdto, c) => { c.ModifiedBy = cdto.ModifiedByClient.Id; c.CreatedBy = cdto.CreatedByClient.Id; }); }).CreateMapper(); producerMapper = new MapperConfiguration(cfg => { cfg.CreateMap <Producer, ProducerDTO>().AfterMap((p, pdto) => { pdto.ModifiedByClient = IdentityMapper.GetClientById(p.ModifiedBy); pdto.CreatedByClient = IdentityMapper.GetClientById(p.CreatedBy); }); cfg.CreateMap <ProducerDTO, Producer>().AfterMap((pdto, p) => { p.ModifiedBy = pdto.ModifiedByClient.Id; p.CreatedBy = pdto.CreatedByClient.Id; }); }).CreateMapper(); componentMapper = new MapperConfiguration(cfg => { cfg.CreateMap <LiquidComponent, ComponentDTO>().AfterMap((c, cdto) => { cdto.ModifiedByClient = IdentityMapper.GetClientById(c.ModifiedBy); cdto.CreatedByClient = IdentityMapper.GetClientById(c.CreatedBy); cdto.Producer = producerMapper.Map <ProducerDTO>(Database.Lineages.FindById(c.ProducerId)); cdto.ComponentType = componentTypeMapper.Map <ComponentTypeDTO>(Database.Lineages.FindById(c.TypeId)); }); cfg.CreateMap <ComponentDTO, LiquidComponent>().AfterMap((cdto, c) => { c.ModifiedBy = cdto.ModifiedByClient.Id; c.CreatedBy = cdto.CreatedByClient.Id; c.ProducerId = cdto.Producer.Id; c.TypeId = cdto.ComponentType.Id; }); }).CreateMapper(); }