当前位置:网站首页>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 .
边栏推荐
- 用GSConv+Slim Neck改进Yolov5,将性能提升到极致!
- C language learning notes: type definition typedef and declaration external CSDN creation punch in
- 数据仓库(四)之ETL开发
- Qt中的QFile读写文件操作
- Altair HyperWorks 2022 software installation package and installation tutorial
- 实例讲解将Graph Explorer搬上JupyterLab
- Go语言自学系列 | go语言数据类型
- AI training speed breaks Moore's law; Song shuran's team won the RSS 2022 Best Paper Award
- 华为联机对战服务玩家掉线重连案例总结
- 市值蒸发740亿,这位大佬转身杀入预制菜
猜你喜欢
宏观视角看抖音全生态
bean的生命周期核心步骤总结
洞态在某互联⽹⾦融科技企业的最佳落地实践
如何使用物联网低代码平台进行个人设置?
实现一个Prometheus exporter
华为云专家详解GaussDB(for MySQL)新特性
如何在自有APP内实现小程序实现连麦直播
[quick application] there are many words in the text component. How to solve the problem that the div style next to it will be stretched
Must see, time series analysis
Privacy sandbox is finally coming
随机推荐
Altair HyperWorks 2022 software installation package and installation tutorial
Technology implementation and Architecture Practice
Memo - about C # generating barcode
How to realize the applet in its own app to realize continuous live broadcast
R语言使用epiDisplay包的followup.plot函数可视化多个ID(病例)监测指标的纵向随访图、使用n.of.lines参数指定显示的病例数
Evaluation of 6 red, yellow and black list cameras: who is the safest? Who has good picture quality? From now on, let you no longer step on thunder
[AGC] how to solve the problem that the local display of event analysis data is inconsistent with that in AGC panel?
搭建一个通用监控告警平台,架构上需要有哪些设计
R language uses the DOTPLOT function of epidisplay package to visualize the frequency of data points in different intervals in the form of point graph, and uses PCH parameters to customize the shape o
Must see, time series analysis
OpenAI|视频预训练 (VPT):基于观看未标记的在线视频的行动学习
市值蒸发740亿,这位大佬转身杀入预制菜
实例讲解将Graph Explorer搬上JupyterLab
Viewing the whole ecology of Tiktok from a macro perspective
JS find the next adjacent element of the number in the array
R语言使用epiDisplay包的tableStack函数制作统计汇总表格(基于目标变量分组的描述性统计、假设检验等)、不设置by参数则计算数据框指定数据列范围的基础描述性统计信息
Taiaisu M source code construction, peak store app premium consignment source code sharing
网易游戏,激进出海
Reading notes series "modern methods of C language programming" -- Chapter 2
lefse分析