当前位置:网站首页>Yyds dry inventory ravendb start client API (III)
Yyds dry inventory ravendb start client API (III)
2022-07-01 19:05:00 【four hundred and ninety-four million three hundred and twenty-f】
Delete()
We can go through Delete Method to delete a document , This method accepts instance entities or documents ID. The following code is the method of deleting documents :
Bite here ,Delete Method does not delete the document , Just mark the document as deleted in the session , Only when calling SaveChanges Method document will be deleted .
Query()
In most cases, we will use view , Some query codes have been shown in this topic , Therefore, the query code is no longer listed in this section . And through the Load Call the loaded document , adopt Query The loaded document is also managed by the session . After we modify or delete the document , You also need to call SaveChanges Method to update RavenDB, And use Query There is only one instance of the queried document in the session , No matter how many times you check . Pay attention here RavenDB Calculation during query is not allowed ( for example :SUM、AVG Such calculations ), And it doesn't have the problem of table scanning or slow query . We will explain the reason in detail and introduce the detailed information about the index in the third part , But now you can see that most queries are suitable for you .
Store()
Store The method is to associate the entity with the session . We only do this when we want to create a new document . The case code is as follows :
Again , And Delete The method is the same , Only when calling SaveChanges After the method , Data will be really saved in RavenDB in , And for the new ,RavenDB Will provide a ID. In addition to preserving the new body ,Store You can also associate existing document entities with sessions , This situation is generally used when the service weapon sends entities to the client , The client modifies the entity and sends it back Web Applications . But at this time, it was found that it was not loaded by the session nor tracked . Then you can call Store Method to bind entities and sessions , And its ID It's not empty ,RavenDB Think it exists in the Library , Therefore, it will be stored in the library in the form of updates .
SaveChanges()
SaveChanges Method is used to check all deleted and changed session States , Then send these to the server as a transaction , Therefore, this ensures that partial saving will not fail because of exceptions in the middle . call SaveChanges When the method is used , The entity loaded in the database and the current entity will be checked for changes . If there is a change , Then the entity will be saved to the database . The code is as follows :
Advanced
Ahead API Are common scenes , But there must be some unusual scenes , We can use Advanced To solve . For example, we can use it to configure optimistic concurrent behavior on a per session basis :
You can also modify the Convention to globally define :
I will explain the specific content in the following topics .
边栏推荐
- How to operate technology related we media well?
- Clean up system cache and free memory under Linux
- 苹果产品在日本全面涨价,iPhone13涨19%
- Lumiprobe Lumizol RNA 提取试剂解决方案
- Altair HyperWorks 2022 software installation package and installation tutorial
- LeetCode-21合并两个有序链表
- How to use the low code platform of the Internet of things for personal settings?
- LiveData postValue会“丢”数据
- R语言使用epiDisplay包的followup.plot函数可视化多个ID(病例)监测指标的纵向随访图、使用n.of.lines参数指定显示的病例数
- Implement a Prometheus exporter
猜你喜欢

LiveData postValue会“丢”数据

OpenAI|视频预训练 (VPT):基于观看未标记的在线视频的行动学习

Improve yolov5 with gsconv+slim neck to maximize performance!

Openai video pre training (VPT): action learning based on watching unmarked online videos

Go Technology Daily (2022-02-14) - go language slice interview real questions 8 consecutive questions

华为云专家详解GaussDB(for MySQL)新特性

中英说明书丨人可溶性晚期糖基化终末产物受体(sRAGE)Elisa试剂盒

Basic knowledge and commands of disk

Must see, time series analysis

用WPF写一款开源方便、快捷的数据库文档查询、生成工具
随机推荐
R语言使用epiDisplay包的aggregate函数将数值变量基于因子变量拆分为不同的子集,计算每个子集的汇总统计信息
R language uses follow up of epidisplay package Plot function visualizes the longitudinal follow-up map of multiple ID (case) monitoring indicators, and uses n.of The lines parameter specifies the num
网易游戏,激进出海
Huawei game failed to initialize init with error code 907135000
ES6数组去重的三个简单办法
Usage and underlying implementation principle of PriorityQueue
Stanford, salesforce|maskvit: masked vision pre training for video prediction
Three simple methods of ES6 array de duplication
Viewing the whole ecology of Tiktok from a macro perspective
Navicat premium 15 permanent cracking and 2021 latest idea cracking (valid for personal testing)
R语言epiDisplay包ordinal.or.display函数获取有序logistic回归模型的汇总统计信息(变量对应的优势比及其置信区间、以及假设检验的p值)、write.csv函数保存csv
用WPF写一款开源方便、快捷的数据库文档查询、生成工具
Huawei cloud experts explain the new features of gaussdb (for MySQL)
摄像头的MIPI接口、DVP接口和CSI接口[通俗易懂]
Lumiprobe非荧光炔烃丨EU(5-乙炔基尿苷)
R语言ggplot2可视化:gganimate创建动态柱状图动画(gif)、在动画中沿给定维度逐步显示柱状图、enter_grow函数和enter_fade函数控制运动内插退出(渐变tweening)
Docker deploy mysql8.0
Database foundation: select basic query statement
How to operate technology related we media well?
ETL development of data warehouse (IV)