Esempio n. 1
0
        public static BSONDocument ToBson(Event evt)
        {
            var doc = new BSONDocument();

            doc.Set(DataDocConverter.GDID_CLRtoBSON(FLD_GDID, evt.Gdid));

            //long is enough to hold positive date (2^63) for 292 million years
            doc.Set(new BSONInt64Element(FLD_CREATEUTC, (long)evt.CreateUtc));
            doc.Set(new BSONInt64Element(FLD_ORIGIN, (long)evt.Origin.ID));
            doc.Set(new BSONInt64Element(FLD_CHECKPOINTUTC, (long)evt.CheckpointUtc));//same as above

            if (evt.Headers.IsNullOrWhiteSpace())
            {
                doc.Set(new BSONNullElement(FLD_HEADERS));
            }
            else
            {
                doc.Set(new BSONStringElement(FLD_HEADERS, evt.Headers));
            }

            doc.Set(new BSONInt64Element(FLD_CONTENTTYPE, (long)evt.ContentType.ID));
            doc.Set(DataDocConverter.ByteBuffer_CLRtoBSON(FLD_CONTENT, evt.Content));

            return(doc);
        }
Esempio n. 2
0
                                 internal void PutRaw(string table, byte[] key, byte[] value, int slidingExpirationDays, DateTime?absoluteExpirationDateUtc)
                                 {
                                     var elmValue = DataDocConverter.ByteBuffer_CLRtoBSON(FIELD_VALUE, value);

                                     putCore(table, key, elmValue, slidingExpirationDays, absoluteExpirationDateUtc);
                                 }