示例#1
0
        public EventMessage ToEvent(string appId)
        {
            var result = SimpleMapper.Map(this, new EventMessage());

            if (Preformatted != null)
            {
                result.Formatting = Preformatted.ToDomainObject();
            }

            if (Settings?.Any() == true)
            {
                result.Settings = new NotificationSettings();

                foreach (var(key, value) in Settings)
                {
                    if (value != null)
                    {
                        result.Settings[key] = value.ToDomainObject();
                    }
                }
            }

            if (Scheduling != null)
            {
                result.Scheduling = Scheduling.ToDomainObject();
            }
            else
            {
                result.Scheduling = new Scheduling();
            }

            if (result.Properties == null)
            {
                result.Properties = new EventProperties();
            }

            result.AppId = appId;

            return(result);
        }
示例#2
0
        public EventMessage ToEvent(string appId, string?topic = null)
        {
            var result = SimpleMapper.Map(this, new EventMessage());

            if (Preformatted != null)
            {
                result.Formatting = Preformatted.ToDomainObject();
            }

            if (Settings?.Any() == true)
            {
                result.Settings = new ChannelSettings();

                foreach (var(key, value) in Settings)
                {
                    if (value != null)
                    {
                        result.Settings[key] = value.ToDomainObject();
                    }
                }
            }

            if (Scheduling != null)
            {
                result.Scheduling = Scheduling.ToDomainObject();
            }
            else
            {
                result.Scheduling = new Scheduling();
            }

            if (topic != null)
            {
                result.Topic = topic;
            }

            result.AppId = appId;

            return(result);
        }