/// <summary>
        /// Further configure this info object based on the options specified by the caller, then enqueue it for bulk insertion.
        /// </summary>
        private void Initialize(InteractionTransactionInfo info)
        {
            if (info == null)
            {
                return;
            }

            info.Initialize(InteractionInfoQueue);
        }
        /// <summary>
        /// Merge the supplied arguments, giving precedence to the info object for any conflicting values.
        /// </summary>
        /// <param name="channelTypeMediumValueId">The channel type medium value identifier.</param>
        /// <param name="channelEntityId">The channel entity identifier.</param>
        /// <param name="channelName">Name of the channel.</param>
        /// <param name="componentEntityTypeId">The component entity type identifier.</param>
        /// <param name="componentEntityId">The component entity identifier.</param>
        /// <param name="componentName">Name of the component.</param>
        /// <param name="info">The information about the <see cref="Interaction"/> object graph to be logged.</param>
        private void Initialize(int channelTypeMediumValueId, int?channelEntityId, string channelName, int?componentEntityTypeId, int componentEntityId, string componentName, InteractionTransactionInfo info)
        {
            info = info ?? new InteractionTransactionInfo();

            info.ChannelTypeMediumValueId = info.ChannelTypeMediumValueId > 0 ? info.ChannelTypeMediumValueId : channelTypeMediumValueId;
            info.ChannelEntityId          = info.ChannelEntityId > 0 ? info.ChannelEntityId : channelEntityId;
            info.ChannelName           = info.ChannelName.IsNotNullOrWhiteSpace() ? info.ChannelName : channelName;
            info.ComponentEntityTypeId = info.ComponentEntityTypeId > 0 ? info.ComponentEntityTypeId : componentEntityTypeId;
            info.ComponentEntityId     = info.ComponentEntityId > 0 ? info.ComponentEntityId : componentEntityId;
            info.ComponentName         = info.ComponentName.IsNotNullOrWhiteSpace() ? info.ComponentName : componentName;

            Initialize(info);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="InteractionTransaction" /> class.
        /// </summary>
        /// <param name="channelTypeMediumValue">The channel type medium value.</param>
        /// <param name="channelEntity">The channel entity.</param>
        /// <param name="componentEntityCache">The component entity cache.</param>
        /// <param name="info">The information.</param>
        public InteractionTransaction(DefinedValueCache channelTypeMediumValue, IEntity channelEntity, IEntityCache componentEntityCache, InteractionTransactionInfo info)
        {
            if (channelTypeMediumValue == null || componentEntityCache == null)
            {
                return;
            }

            if (info?.InteractionChannelId == default && channelEntity == null)
            {
                // we need either an InteractionChannelId or a channelEntity
                return;
            }

            // NOTE: Just in case this seem confusing, the EntityType of ChannelEntity tells us what the *component* entity type id is!
            var componentEntityTypeId = channelEntity?.TypeId;

            Initialize(channelTypeMediumValue.Id, channelEntity?.Id, channelEntity?.ToString(), componentEntityTypeId, componentEntityCache.Id, componentEntityCache.ToString(), info);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="InteractionTransaction"/> class.
 /// </summary>
 /// <param name="info">The information about the <see cref="Interaction"/> object graph to be logged.</param>
 public InteractionTransaction(InteractionTransactionInfo info)
 {
     Initialize(info);
 }
Exemplo n.º 5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="InteractionTransaction"/> class.
        /// </summary>
        /// <param name="channelTypeMediumValue">The channel medium type value.</param>
        /// <param name="channelEntity">The channel entity.</param>
        /// <param name="componentEntity">The component entity.</param>
        /// <param name="info">
        /// The information about the <see cref="Interaction"/> object graph to be logged.
        /// In the case of conflicting values (i.e. channelEntity.Id vs info.ChannelEntityId), any values explicitly set on the <paramref name="info"/> parameter will take precedence.
        /// </param>
        public InteractionTransaction(DefinedValueCache channelTypeMediumValue, IEntityCache channelEntity, IEntityCache componentEntity, InteractionTransactionInfo info)
        {
            if (channelTypeMediumValue == null || channelEntity == null || componentEntity == null)
            {
                return;
            }

            Initialize(channelTypeMediumValue.Id, channelEntity.Id, channelEntity.ToString(), channelEntity.CachedEntityTypeId, componentEntity.Id, componentEntity.ToString(), info);
        }