public ProductService(IUnitOfWork unitOfWork, ISimpleMapper mapper, INotificationService notificationService, IProductEventFactory factory) { _unitOfWork = unitOfWork; _mapper = mapper; _factory = factory; _notificationService = notificationService; }
public static ExpandoObject ShapeData(this ISimpleMapper simpleMapper, object source, string fields, bool fillNullIfNotExist = false) { var items = fields.Split(','); var fixItems = items.Where(x => !string.IsNullOrWhiteSpace(x)).Select(x => x.Trim()); return(simpleMapper.ShapeData(source, fixItems, fillNullIfNotExist)); }
/// <summary> /// Tries to map the given instance into generic destination type using an specific key service. /// </summary> /// <typeparam name="TSource">The type of the source.</typeparam> /// <typeparam name="TDestination">The type of the destination.</typeparam> /// <param name="source">The source.</param> /// <param name="keyService">The key service.</param> /// <returns></returns> public TDestination TryToMap <TSource, TDestination>(TSource source, object keyService) { object src = source; if (src == null) { return(default(TDestination)); } var serviceMapper = this.mapperResolver.FirstOrDefault( transformer => transformer.Match(keyService, typeof(TSource), typeof(TDestination))); if (serviceMapper == null) { return(default(TDestination)); } ISimpleMapper <TSource, TDestination> mapper = serviceMapper.ServiceAs <ISimpleMapper <TSource, TDestination> >(); if (mapper != null) { return(mapper.Map(source)); } ISourceMapper mp = serviceMapper.ServiceAs <ISourceMapper>(); if (mp == null) { return(default(TDestination)); } return((TDestination)mp.Map(source)); }
public NotificationService(IUnitOfWork unitOfWork, ISimpleMapper mapper, INotificationManager notificationManager) { _unitOfWork = unitOfWork; _mapper = mapper; _notificationManager = notificationManager; }
public TagService(IUnitOfWork unitOfWork, ISimpleMapper mapper) { _unitOfWork = unitOfWork; _mapper = mapper; }