コード例 #1
0
        public async void InsertLog(ILoggable loggable)
        {
            if (loggable == null)
            {
                return;
            }

            IMongoCollection <BsonDocument> collection = Database.GetCollection <BsonDocument>(loggable.Collection);

            if (collection == null)
            {
                await Database.CreateCollectionAsync(loggable.Collection);

                collection = Database.GetCollection <BsonDocument>(loggable.Collection);
            }

            await collection.InsertOneAsync(loggable.ToBsonDocument());
        }