/// <summary>
        /// Map from the domain object to the properties of the current DTO instance.
        /// </summary>
        public override void MapFrom(MMDash.Data.Models.ApplicationUser obj, IMappingContext context, IncludeTree tree = null)
        {
            if (obj == null)
            {
                return;
            }
            var includes = context.Includes;

            // Fill the properties of the object.

            this.ApplicationUserId = obj.ApplicationUserId;
            this.Name                 = obj.Name;
            this.Id                   = obj.Id;
            this.UserName             = obj.UserName;
            this.NormalizedUserName   = obj.NormalizedUserName;
            this.Email                = obj.Email;
            this.NormalizedEmail      = obj.NormalizedEmail;
            this.EmailConfirmed       = obj.EmailConfirmed;
            this.PasswordHash         = obj.PasswordHash;
            this.SecurityStamp        = obj.SecurityStamp;
            this.ConcurrencyStamp     = obj.ConcurrencyStamp;
            this.PhoneNumber          = obj.PhoneNumber;
            this.PhoneNumberConfirmed = obj.PhoneNumberConfirmed;
            this.TwoFactorEnabled     = obj.TwoFactorEnabled;
            this.LockoutEnd           = obj.LockoutEnd;
            this.LockoutEnabled       = obj.LockoutEnabled;
            this.AccessFailedCount    = obj.AccessFailedCount;
        }
Example #2
0
        /// <summary>
        /// Map from the domain object to the properties of the current DTO instance.
        /// </summary>
        public override void MapFrom(Coalesce.Domain.Company obj, IMappingContext context, IncludeTree tree = null)
        {
            if (obj == null)
            {
                return;
            }
            var includes = context.Includes;

            // Fill the properties of the object.

            this.CompanyId = obj.CompanyId;
            this.Name      = obj.Name;
            this.Address1  = obj.Address1;
            this.Address2  = obj.Address2;
            this.City      = obj.City;
            this.State     = obj.State;
            this.ZipCode   = obj.ZipCode;
            this.IsDeleted = obj.IsDeleted;
            this.AltName   = obj.AltName;
            var propValEmployees = obj.Employees;

            if (propValEmployees != null && (tree == null || tree[nameof(this.Employees)] != null))
            {
                this.Employees = propValEmployees
                                 .OrderBy(f => f.PersonId)
                                 .Select(f => f.MapToDto <Coalesce.Domain.Person, PersonDtoGen>(context, tree?[nameof(this.Employees)])).ToList();
            }
            else if (propValEmployees == null && tree?[nameof(this.Employees)] != null)
            {
                this.Employees = new PersonDtoGen[0];
            }
        }
Example #3
0
        private ObjectMappingData(
            TSource source,
            TTarget target,
            int?enumerableIndex,
            MappingTypes mappingTypes,
            IMappingContext mappingContext,
            IObjectMappingData declaredTypeMappingData,
            IObjectMappingData parent,
            bool createMapper)
            : base(source, target, enumerableIndex, parent, mappingContext)
        {
            MappingTypes            = mappingTypes;
            MappingContext          = mappingContext;
            DeclaredTypeMappingData = declaredTypeMappingData;

            if (parent != null)
            {
                Parent = parent;
                return;
            }

            if (createMapper)
            {
                _mapper = MapperContext.ObjectMapperFactory.GetOrCreateRoot(this);
            }
        }
        /// <summary>
        /// Map from the domain object to the properties of the current DTO instance.
        /// </summary>
        public override void MapFrom(MMDash.Data.Models.VoiceTransmission obj, IMappingContext context, IncludeTree tree = null)
        {
            if (obj == null)
            {
                return;
            }
            var includes = context.Includes;

            // Fill the properties of the object.

            this.VoiceTransmissionId       = obj.VoiceTransmissionId;
            this.TransmissionDateTimeStart = obj.TransmissionDateTimeStart;
            this.TransmissionDateTimeEnd   = obj.TransmissionDateTimeEnd;
            this.CallSignId = obj.CallSignId;
            this.ServerId   = obj.ServerId;
            this.TalkGroup  = obj.TalkGroup;
            this.LossRate   = obj.LossRate;
            if (tree == null || tree[nameof(this.CallSign)] != null)
            {
                this.CallSign = obj.CallSign.MapToDto <MMDash.Data.Models.CallSign, CallSignDtoGen>(context, tree?[nameof(this.CallSign)]);
            }

            if (tree == null || tree[nameof(this.Server)] != null)
            {
                this.Server = obj.Server.MapToDto <MMDash.Data.Models.Server, ServerDtoGen>(context, tree?[nameof(this.Server)]);
            }
        }
        private ObjectMappingData(
            TSource source,
            TTarget target,
            int?enumerableIndex,
            ObjectMapperKeyBase mapperKey,
            IMappingContext mappingContext,
            IObjectMappingData declaredTypeMappingData,
            IObjectMappingData parent)
            : base(source, target, enumerableIndex, parent)
        {
            MapperKey               = mapperKey;
            MappingContext          = mappingContext;
            DeclaredTypeMappingData = declaredTypeMappingData;

            if (parent != null)
            {
                _parent = parent;
                return;
            }

            IsRoot = true;

            if (IsPartOfDerivedTypeMapping)
            {
                return;
            }

            _mapper = MapperContext.ObjectMapperFactory.GetOrCreateRoot(this);

            if (MapperData.MappedObjectCachingNeeded)
            {
                _mappedObjectsBySource = new Dictionary <object, List <object> >(13);
            }
        }
        /// <summary>
        /// Map from the domain object to the properties of the current DTO instance.
        /// </summary>
        public override void MapFrom(SendGridDemo.Data.Models.EmailMessage obj, IMappingContext context, IncludeTree tree = null)
        {
            if (obj == null)
            {
                return;
            }
            var includes = context.Includes;

            // Fill the properties of the object.

            this.Subject     = obj.Subject;
            this.LastStatus  = obj.LastStatus;
            this.pkMessageId = obj.pkMessageId;
            this.MessageId   = obj.MessageId;
            this.To          = obj.To;
            this.MessageText = obj.MessageText;
            var propValEmailEvents = obj.EmailEvents;

            if (propValEmailEvents != null && (tree == null || tree[nameof(this.EmailEvents)] != null))
            {
                this.EmailEvents = propValEmailEvents
                                   .AsQueryable().OrderBy("EmailMessageEventId ASC").AsEnumerable <SendGridDemo.Data.Models.EmailMessageEvent>()
                                   .Select(f => f.MapToDto <SendGridDemo.Data.Models.EmailMessageEvent, EmailMessageEventDtoGen>(context, tree?[nameof(this.EmailEvents)])).ToList();
            }
            else if (propValEmailEvents == null && tree?[nameof(this.EmailEvents)] != null)
            {
                this.EmailEvents = new EmailMessageEventDtoGen[0];
            }
        }
Example #7
0
        public static IObjectMappingData ForRoot<TSource, TTarget>(
            TSource source,
            TTarget target,
            IMappingContext mappingContext)
        {
            MappingTypes mappingTypes;

            if ((target == null) && (typeof(TTarget) == typeof(object)))
            {
                // This is a 'create new' mapping where the target type has come 
                // through as 'object'. This happens when you use .ToANew<dynamic>(),
                // and I can't see how to differentiate that from .ToANew<object>().
                // Given that the former is more likely and that people asking for 
                // .ToANew<object>() are doing something weird, default the target 
                // type to ExpandoObject:
                mappingTypes = MappingTypes.For(source, default(ExpandoObject));

                return Create(
                    source,
                    default(ExpandoObject),
                    null,
                    mappingTypes,
                    mappingContext);
            }

            mappingTypes = MappingTypes.For(source, target);

            return Create(
                source,
                target,
                null,
                mappingTypes,
                mappingContext);
        }
        /// <summary>
        /// Map from the current DTO instance to the domain object.
        /// </summary>
        public override void MapTo(MMDash.Data.Models.ApplicationUser entity, IMappingContext context)
        {
            var includes = context.Includes;

            if (OnUpdate(entity, context))
            {
                return;
            }

            entity.Name                 = Name;
            entity.UserName             = UserName;
            entity.NormalizedUserName   = NormalizedUserName;
            entity.Email                = Email;
            entity.NormalizedEmail      = NormalizedEmail;
            entity.EmailConfirmed       = (EmailConfirmed ?? false);
            entity.PasswordHash         = PasswordHash;
            entity.SecurityStamp        = SecurityStamp;
            entity.ConcurrencyStamp     = ConcurrencyStamp;
            entity.PhoneNumber          = PhoneNumber;
            entity.PhoneNumberConfirmed = (PhoneNumberConfirmed ?? false);
            entity.TwoFactorEnabled     = (TwoFactorEnabled ?? false);
            entity.LockoutEnd           = LockoutEnd;
            entity.LockoutEnabled       = (LockoutEnabled ?? false);
            entity.AccessFailedCount    = (AccessFailedCount ?? 0);
        }
Example #9
0
 public TN Map(IMappingContext <T, TN> context)
 {
     if (context == null)
     {
         throw new ArgumentNullException("context");
     }
     return(_mapFunc(context.Source));
 }
Example #10
0
 public GeneralViewModel Map(IMappingContext <GeneralModel, GeneralViewModel> context)
 {
     return(new GeneralViewModel
     {
         Id = context.Source.Id,
         Gender = Utils.ResolveGender(context.Source.Gender),
         FullName = context.Source.FirstName + " " + context.Source.LastName
     });
 }
Example #11
0
 public InlineMapperKey(
     Expression <Action <TConfigurator> >[] configurations,
     Func <MappingConfigInfo, TConfigurator> configuratorFactory,
     IMappingContext mappingContext)
 {
     _configurations      = configurations;
     _configuratorFactory = configuratorFactory;
     _mappingContext      = mappingContext;
 }
Example #12
0
 public void MapFrom(Case obj, IMappingContext context = null, IncludeTree tree = null)
 {
     CaseId = obj.CaseKey;
     Title  = obj.Title;
     if (obj.AssignedTo != null)
     {
         AssignedToName = obj.AssignedTo.Name;
     }
 }
Example #13
0
        /// <summary>
        /// Map from the current DTO instance to the domain object.
        /// </summary>
        public override void MapTo(Coalesce.Domain.ProductDetails entity, IMappingContext context)
        {
            var includes = context.Includes;

            if (OnUpdate(entity, context))
            {
                return;
            }
        }
Example #14
0
        /// <summary>
        /// Map from the domain object to the properties of the current DTO instance.
        /// </summary>
        public override void MapFrom(Coalesce.Domain.Person obj, IMappingContext context, IncludeTree tree = null)
        {
            if (obj == null)
            {
                return;
            }
            var includes = context.Includes;

            // Fill the properties of the object.

            this.PersonId    = obj.PersonId;
            this.Title       = obj.Title;
            this.FirstName   = obj.FirstName;
            this.LastName    = obj.LastName;
            this.Email       = obj.Email;
            this.Gender      = obj.Gender;
            this.BirthDate   = obj.BirthDate;
            this.LastBath    = obj.LastBath;
            this.NextUpgrade = obj.NextUpgrade;
            this.Name        = obj.Name;
            this.CompanyId   = obj.CompanyId;
            this.ArbitraryCollectionOfStrings = obj.ArbitraryCollectionOfStrings;
            var propValCasesAssigned = obj.CasesAssigned;

            if (propValCasesAssigned != null && (tree == null || tree[nameof(this.CasesAssigned)] != null))
            {
                this.CasesAssigned = propValCasesAssigned
                                     .OrderByDescending(f => f.OpenedAt).ThenBy(f => (f.AssignedTo == null ? "" : f.AssignedTo.FirstName)).ThenBy(f => f.CaseKey)
                                     .Select(f => f.MapToDto <Coalesce.Domain.Case, CaseDtoGen>(context, tree?[nameof(this.CasesAssigned)])).ToList();
            }
            else if (propValCasesAssigned == null && tree?[nameof(this.CasesAssigned)] != null)
            {
                this.CasesAssigned = new CaseDtoGen[0];
            }

            var propValCasesReported = obj.CasesReported;

            if (propValCasesReported != null && (tree == null || tree[nameof(this.CasesReported)] != null))
            {
                this.CasesReported = propValCasesReported
                                     .OrderByDescending(f => f.OpenedAt).ThenBy(f => (f.AssignedTo == null ? "" : f.AssignedTo.FirstName)).ThenBy(f => f.CaseKey)
                                     .Select(f => f.MapToDto <Coalesce.Domain.Case, CaseDtoGen>(context, tree?[nameof(this.CasesReported)])).ToList();
            }
            else if (propValCasesReported == null && tree?[nameof(this.CasesReported)] != null)
            {
                this.CasesReported = new CaseDtoGen[0];
            }


            this.PersonStats = obj.PersonStats.MapToDto <Coalesce.Domain.PersonStats, PersonStatsDtoGen>(context, tree?[nameof(this.PersonStats)]);

            if (tree == null || tree[nameof(this.Company)] != null)
            {
                this.Company = obj.Company.MapToDto <Coalesce.Domain.Company, CompanyDtoGen>(context, tree?[nameof(this.Company)]);
            }
        }
Example #15
0
        /// <summary>
        /// Map from the domain object to the properties of the current DTO instance.
        /// </summary>
        public override void MapFrom(Coalesce.Domain.Person obj, IMappingContext context, IncludeTree tree = null)
        {
            if (obj == null)
            {
                return;
            }
            var includes = context.Includes;

            // Fill the properties of the object.

            this.PersonId    = obj.PersonId;
            this.Title       = obj.Title;
            this.FirstName   = obj.FirstName;
            this.LastName    = obj.LastName;
            this.Email       = obj.Email;
            this.Gender      = obj.Gender;
            this.BirthDate   = obj.BirthDate;
            this.LastBath    = obj.LastBath;
            this.NextUpgrade = obj.NextUpgrade;
            this.ProfilePic  = obj.ProfilePic;
            this.Name        = obj.Name;
            this.CompanyId   = obj.CompanyId;
            var propValCasesAssigned = obj.CasesAssigned;

            if (propValCasesAssigned != null && (tree == null || tree[nameof(this.CasesAssigned)] != null))
            {
                this.CasesAssigned = propValCasesAssigned
                                     .AsQueryable().OrderBy("CaseKey ASC").AsEnumerable <Coalesce.Domain.Case>()
                                     .Select(f => f.MapToDto <Coalesce.Domain.Case, CaseDtoGen>(context, tree?[nameof(this.CasesAssigned)])).ToList();
            }
            else if (propValCasesAssigned == null && tree?[nameof(this.CasesAssigned)] != null)
            {
                this.CasesAssigned = new CaseDtoGen[0];
            }

            var propValCasesReported = obj.CasesReported;

            if (propValCasesReported != null && (tree == null || tree[nameof(this.CasesReported)] != null))
            {
                this.CasesReported = propValCasesReported
                                     .AsQueryable().OrderBy("CaseKey ASC").AsEnumerable <Coalesce.Domain.Case>()
                                     .Select(f => f.MapToDto <Coalesce.Domain.Case, CaseDtoGen>(context, tree?[nameof(this.CasesReported)])).ToList();
            }
            else if (propValCasesReported == null && tree?[nameof(this.CasesReported)] != null)
            {
                this.CasesReported = new CaseDtoGen[0];
            }


            this.PersonStats = obj.PersonStats.MapToDto <Coalesce.Domain.PersonStats, PersonStatsDtoGen>(context, tree?[nameof(this.PersonStats)]);

            if (tree == null || tree[nameof(this.Company)] != null)
            {
                this.Company = obj.Company.MapToDto <Coalesce.Domain.Company, CompanyDtoGen>(context, tree?[nameof(this.Company)]);
            }
        }
Example #16
0
        public SizeViewModel Map(IMappingContext <Size, SizeViewModel> context)
        {
            var sizeViewModel = context.Destination ?? new SizeViewModel();

            sizeViewModel.Id        = context.Source.Id;
            sizeViewModel.Alias     = context.Source.Alias;
            sizeViewModel.Name      = context.Source.Name;
            sizeViewModel.SortOrder = context.Source.SortOrder;
            return(sizeViewModel);
        }
 public static MapperContext ConfigureMapperContext(
     IEnumerable <Expression <Action <IFullMappingInlineConfigurator <TSource, TTarget> > > > configurations,
     IMappingContext mappingContext)
 {
     return(ConfigureMapperContext(
                configurations,
                configInfo => new MappingConfigurator <TSource, TTarget>(configInfo),
                mappingContext.RuleSet,
                mappingContext.MapperContext));
 }
 public static ObjectMappingData <IQueryable <TSourceElement>, IQueryable <TResultElement> > ForProjection <TSourceElement, TResultElement>(
     IQueryable <TSourceElement> sourceQueryable,
     IMappingContext mappingContext)
 {
     return(ForRootFixedTypes(
                sourceQueryable,
                default(IQueryable <TResultElement>),
                MappingTypes <TSourceElement, TResultElement> .Fixed,
                mappingContext));
 }
Example #19
0
        private static MappingPlan GetMappingPlan <TTarget>(
            IMappingContext planContext,
            Func <IMappingContext, IObjectMappingData> mappingDataFactory,
            ICollection <Expression <Action <IFullMappingInlineConfigurator <TSource, TTarget> > > > configurations = null)
        {
            if (configurations?.Any() == true)
            {
                InlineMappingConfigurator <TSource, TTarget>
#if NET35
                .ConfigureMapperContext(configurations.Project(c => c.ToDlrExpression()), planContext);
        public Size Map(IMappingContext <Size, Size> context)
        {
            var deepCopy = new Size();

            deepCopy.Id        = context.Source.Id;
            deepCopy.Alias     = context.Source.Alias;
            deepCopy.Name      = context.Source.Name;
            deepCopy.SortOrder = context.Source.SortOrder;
            return(deepCopy);
        }
Example #21
0
        public List <TestViewModel> Map(IMappingContext <List <TestModel>, List <TestViewModel> > context)
        {
            var testViewModels = context.Destination ?? new List <TestViewModel>();

            foreach (var testModel in context.Source)
            {
                testViewModels.Add(Mapper.Map <TestModel, TestViewModel>(testModel));
            }
            return(testViewModels);
        }
Example #22
0
        /// <summary>Mapper is the Business Logic Layer for the module, this is where the template and data gets mapped to the View Model.</summary>
        /// <param name="model">The model.</param>
        /// <param name="mappingContext">The module Context.</param>
        /// <returns>The <see cref="ChatViewModel"/>.</returns>
        public static ChatViewModel MapChatModule(ChatModel model, IMappingContext mappingContext)
        {
            #region Set Default Values & Validation

            // Default phone number (hard coded)
            if (string.IsNullOrWhiteSpace(model.PhoneNumber))
            {
                model.PhoneNumber = "1 855-270-0615";
            }
            // Default Phone number info (pulls value from Localization file)
            if (string.IsNullOrWhiteSpace(model.PhoneNumberInfo))
            {
                model.PhoneNumberInfo = model.LOC_Chat_VoicePicker_ButtonPhoneInfo;
            }
            // Default URL for email (hard coded)
            if (string.IsNullOrWhiteSpace(model.URLEMailPage))
            {
                model.URLEMailPage = "https://go.microsoft.com/fwlink/p/?linkid=518644&amp;clcid=0x0409";
            }
            // Validate URL is alive
            if (ValidateURL(model.URLEMailPage))
            {
                model.isURLEMailPageValid = true;
            }
            else
            {
                model.isURLEMailPageValid = false;
            }

            #endregion

            var viewModel = new ChatViewModel()
            {
                // ViewModel                        <-- maps -->                  Model
                ShowTextPicker                           = model.ShowTextPicker,
                ShowEmailPicker                          = model.ShowEmailPicker,
                ShowVoicePicker                          = model.ShowVoicePicker,
                URLEMailPage                             = model.URLEMailPage,
                PhoneNumber                              = model.PhoneNumber,
                PhoneNumberInfo                          = model.PhoneNumberInfo,
                isURLEMailPageValid                      = model.isURLEMailPageValid,
                LOC_Chat_EmailPicker_AriaLabel           = model.LOC_Chat_EmailPicker_AriaLabel,
                LOC_Chat_EmailPicker_ButtonText          = model.LOC_Chat_EmailPicker_ButtonText,
                LOC_Chat_TextPicker_AriaLabel            = model.LOC_Chat_TextPicker_AriaLabel,
                LOC_Chat_TextPicker_ButtonText           = model.LOC_Chat_TextPicker_ButtonText,
                LOC_Chat_VoicePicker_AriaLabel           = model.LOC_Chat_VoicePicker_AriaLabel,
                LOC_Chat_VoicePicker_ButtonPhoneInfo     = model.LOC_Chat_VoicePicker_ButtonPhoneInfo,
                LOC_Chat_ChatBox_Button_AriaLabel        = model.LOC_Chat_ChatBox_Button_AriaLabel,
                LOC_Chat_ChatBox_Button_DataToggledLabel = model.LOC_Chat_ChatBox_Button_DataToggledLabel,
                LOC_Chat_ChatBox_CloseButton_AriaLabel   = model.LOC_Chat_ChatBox_CloseButton_AriaLabel,
                LOC_Chat_ChatBox_CloseButtonText         = model.LOC_Chat_ChatBox_CloseButtonText
            };

            return(viewModel);
        }
Example #23
0
        public MappingPlan(IMappingContext mappingContext)
        {
            _generatedPlanData = new List <MappingPlanData>();

            var rootMappingData = mappingContext
                                  .CreateRootMappingData(default(TSource), default(TTarget));

            var rootPlanData = new MappingPlanData(rootMappingData);

            Expand(rootPlanData);
        }
Example #24
0
        /// <summary>
        /// Test if the current <paramref name="mappingContext" /> can use this data source.
        /// </summary>
        /// <param name="mappingContext">The mapping context.</param>
        /// <returns>
        ///   <c>true</c> if this data source can be used; otherwise <c>false</c>.
        /// </returns>
        public override bool TryMap(IMappingContext mappingContext)
        {
            var memberType = mappingContext?.MemberMapping?.MemberAccessor?.MemberType;

            if (memberType == null)
            {
                return(false);
            }

            return(memberType.GetTypeInfo().IsEnum == true);
        }
        /// <summary>
        /// Map from the domain object to the properties of the current DTO instance.
        /// </summary>
        public override void MapFrom(MMDash.Data.Models.CallSign obj, IMappingContext context, IncludeTree tree = null)
        {
            if (obj == null)
            {
                return;
            }
            var includes = context.Includes;

            // Fill the properties of the object.

            this.CallSignId        = obj.CallSignId;
            this.Text              = obj.Text;
            this.LogCount          = obj.LogCount;
            this.StreamCount       = obj.StreamCount;
            this.TransmissionCount = obj.TransmissionCount;
            var propValLogEntries = obj.LogEntries;

            if (propValLogEntries != null && (tree == null || tree[nameof(this.LogEntries)] != null))
            {
                this.LogEntries = propValLogEntries
                                  .AsQueryable().OrderBy("LogEntryId ASC").AsEnumerable <MMDash.Data.Models.LogEntry>()
                                  .Select(f => f.MapToDto <MMDash.Data.Models.LogEntry, LogEntryDtoGen>(context, tree?[nameof(this.LogEntries)])).ToList();
            }
            else if (propValLogEntries == null && tree?[nameof(this.LogEntries)] != null)
            {
                this.LogEntries = new LogEntryDtoGen[0];
            }

            var propValVoiceTransmissions = obj.VoiceTransmissions;

            if (propValVoiceTransmissions != null && (tree == null || tree[nameof(this.VoiceTransmissions)] != null))
            {
                this.VoiceTransmissions = propValVoiceTransmissions
                                          .AsQueryable().OrderBy("VoiceTransmissionId ASC").AsEnumerable <MMDash.Data.Models.VoiceTransmission>()
                                          .Select(f => f.MapToDto <MMDash.Data.Models.VoiceTransmission, VoiceTransmissionDtoGen>(context, tree?[nameof(this.VoiceTransmissions)])).ToList();
            }
            else if (propValVoiceTransmissions == null && tree?[nameof(this.VoiceTransmissions)] != null)
            {
                this.VoiceTransmissions = new VoiceTransmissionDtoGen[0];
            }

            var propValStreams = obj.Streams;

            if (propValStreams != null && (tree == null || tree[nameof(this.Streams)] != null))
            {
                this.Streams = propValStreams
                               .AsQueryable().OrderBy("StreamId ASC").AsEnumerable <MMDash.Data.Models.Stream>()
                               .Select(f => f.MapToDto <MMDash.Data.Models.Stream, StreamDtoGen>(context, tree?[nameof(this.Streams)])).ToList();
            }
            else if (propValStreams == null && tree?[nameof(this.Streams)] != null)
            {
                this.Streams = new StreamDtoGen[0];
            }
        }
Example #26
0
 public QueueProducerController(
     IConfigurationService configurationService,
     IServiceVersionQueueService queueService,
     IMappingContext mappingContext,
     ILogger <QueueProducerController> logger)
 {
     _lazyServiceConfiguration = new Lazy <IQueueServiceConfiguration>(configurationService.GetServiceConfiguration);
     _queueService             = queueService;
     _mappingContext           = mappingContext;
     _logger = logger;
 }
Example #27
0
        /// <summary>
        /// Map from the current DTO instance to the domain object.
        /// </summary>
        public override void MapTo(Coalesce.Domain.External.DevTeam entity, IMappingContext context)
        {
            var includes = context.Includes;

            if (OnUpdate(entity, context))
            {
                return;
            }

            entity.DevTeamId = (DevTeamId ?? entity.DevTeamId);
            entity.Name      = Name;
        }
        /// <summary>
        /// Map from the current DTO instance to the domain object.
        /// </summary>
        public override void MapTo(MarsError.Data.Models.ApplicationUser entity, IMappingContext context)
        {
            var includes = context.Includes;

            if (OnUpdate(entity, context))
            {
                return;
            }

            entity.ApplicationUserId = (ApplicationUserId ?? entity.ApplicationUserId);
            entity.Name = Name;
        }
Example #29
0
        /// <summary>
        /// Map from the current DTO instance to the domain object.
        /// </summary>
        public override void MapTo(Coalesce.Domain.Services.WeatherData entity, IMappingContext context)
        {
            var includes = context.Includes;

            if (OnUpdate(entity, context))
            {
                return;
            }

            entity.TempFahrenheit = (TempFahrenheit ?? entity.TempFahrenheit);
            entity.Humidity       = (Humidity ?? entity.Humidity);
        }
 public static IObjectMappingData ForRoot <TSource, TTarget>(
     TSource source,
     TTarget target,
     IMappingContext mappingContext)
 {
     return(Create(
                source,
                target,
                null,
                (mt, mc) => new RootObjectMapperKey(mt, mc),
                mappingContext));
 }
 public override bool TryMap(IMappingContext mappingContext)
 {
     var name = mappingContext?.MemberMapping?.MemberAccessor?.Name ?? string.Empty;
     return base.TryMap(mappingContext)
            && Names.Any(n => name.IndexOf(n, StringComparison.OrdinalIgnoreCase) >= 0);
 }
Example #32
0
 public bool TryMap(IMappingContext mappingContext)
 {
     var memberType = mappingContext?.MemberMapping?.MemberAccessor?.MemberType;
     return memberType?.IsEnum == true;
 }
 public override bool TryMap(IMappingContext mappingContext)
 {
     var memberType = mappingContext?.MemberMapping?.MemberAccessor?.MemberType;
     return Types.Any(t => t == memberType);
 }
 public abstract bool TryMap(IMappingContext mappingContext);
 public override bool TryMap(IMappingContext mappingContext)
 {
     var name = mappingContext?.MemberMapping?.MemberAccessor?.Name;
     return base.TryMap(mappingContext)
            && Names.Any(n => string.Equals(name, n, StringComparison.OrdinalIgnoreCase));
 }