private void putCore(string table, byte[] key, BSONElement value, int slidingExpirationDays, DateTime?absoluteExpirationDateUtc) { var db = MongoClient.DatabaseFromConnectString(EffectiveConnectionString); var doc = new BSONDocument() .Set(RowConverter.ByteBufferID_CLRtoBSON(MongoQuery._ID, key)) .Set(value) .Set(new BSONDateTimeElement(FIELD_LAST_USE_DATE, App.TimeSource.UTCNow)) .Set(absoluteExpirationDateUtc.HasValue ? (BSONElement) new BSONDateTimeElement(FIELD_ABSOLUTE_EXPIRATION_DATEUTC, absoluteExpirationDateUtc.Value) : new BSONNullElement(FIELD_ABSOLUTE_EXPIRATION_DATEUTC)) .Set(slidingExpirationDays > -1 ? (BSONElement) new BSONInt32Element(FIELD_SLIDING_EXPIRATION_DAYS, slidingExpirationDays) : new BSONNullElement(FIELD_SLIDING_EXPIRATION_DAYS)); db[table].Save(doc); }