コード例 #1
0
        public async Task UpsertAsync(UserDocument document)
        {
            var options = new FindOneAndReplaceOptions <UserDocument, UserDocument>
            {
                IsUpsert = true
            };

            await _dbContext.Users.FindOneAndReplaceAsync <UserDocument>(d => d.Id == document.Id, document, options);
        }
コード例 #2
0
        public void Upsert(UserDocument document)
        {
            var options = new FindOneAndReplaceOptions <UserDocument, UserDocument>
            {
                IsUpsert = true
            };

            _dbContext.Users.FindOneAndReplace <UserDocument>(d => d.Id == document.Id, document, options);
        }
コード例 #3
0
        public async Task <Guid> AddAsync(UserDocument document)
        {
            await _dbContext.Users.InsertOneAsync(document);

            return(document.Id);
        }
コード例 #4
0
        public Guid Add(UserDocument document)
        {
            _dbContext.Users.InsertOne(document);

            return(document.Id);
        }