Exemplo n.º 1
0
        /// <summary>
        /// Initializes Event belonging to a LibHoney object.
        /// </summary>
        public Event(LibHoney libHoney,
                     IEnumerable <KeyValuePair <string, object> > data, IEnumerable <KeyValuePair <string, Func <object> > > dynFields)
        {
            if (libHoney == null)
            {
                throw new ArgumentNullException(nameof(libHoney));
            }
            if (data == null)
            {
                throw new ArgumentNullException(nameof(data));
            }
            if (dynFields == null)
            {
                throw new ArgumentNullException(nameof(dynFields));
            }

            this.libHoney = libHoney;

            fields.Add(libHoney.Fields);
            fields.Add(data);
            fields.AddDynamic(dynFields);
            fields.EvaluateDynamicFields();  // Evalute all the dynamic fields

            // Stash these values away for Send()
            Timestamp  = DateTime.Now;
            WriteKey   = libHoney.WriteKey;
            DataSet    = libHoney.DataSet;
            ApiHost    = libHoney.ApiHost;
            SampleRate = libHoney.SampleRate;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes Builder belong to a LibHoney object.
        /// </summary>
        public Builder(LibHoney libHoney,
                       IEnumerable <KeyValuePair <string, object> > data, IEnumerable <KeyValuePair <string, Func <object> > > dynFields)
        {
            if (libHoney == null)
            {
                throw new ArgumentNullException(nameof(libHoney));
            }
            if (data == null)
            {
                throw new ArgumentNullException(nameof(data));
            }
            if (dynFields == null)
            {
                throw new ArgumentNullException(nameof(dynFields));
            }

            this.libHoney = libHoney;

            fields.Add(libHoney.Fields);
            fields.Add(data);
            fields.AddDynamic(dynFields);

            // Stash these values away for Send()
            WriteKey   = libHoney.WriteKey;
            DataSet    = libHoney.DataSet;
            ApiHost    = libHoney.ApiHost;
            SampleRate = libHoney.SampleRate;
        }