当前位置:网站首页>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 .
边栏推荐
- 用WPF写一款开源方便、快捷的数据库文档查询、生成工具
- 华为游戏初始化init失败,返回错误码907135000
- 华为联机对战服务玩家掉线重连案例总结
- 力扣每日一题-第32天-589.N×树的前序遍历
- Graduation summary
- 苹果产品在日本全面涨价,iPhone13涨19%
- R语言使用dplyr包的transmute函数计算dataframe数据中的指定数据列的移动窗口均值、使用ggplot2包可视化移动均值与原始数据的折线图
- After studying 11 kinds of real-time chat software, I found that they all have these functions
- Database foundation: select basic query statement
- 【AGC】如何解决事件分析数据本地和AGC面板中显示不一致的问题?
猜你喜欢

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

宏观视角看抖音全生态

Three. JS learning - basic operation of camera (learn from)

Memo - about C # generating barcode for goods

【AGC】如何解决事件分析数据本地和AGC面板中显示不一致的问题?

Memo - about C # generating barcode

研究了11种实时聊天软件,我发现都具备这些功能…

Huawei game failed to initialize init with error code 907135000

Clean up system cache and free memory under Linux

Lumiprobe非荧光炔烃丨EU(5-乙炔基尿苷)
随机推荐
摄像头的MIPI接口、DVP接口和CSI接口[通俗易懂]
力扣每日一题-第32天-1232. 缀点成线
Lumiprobe non fluorescent alkyne EU (5-ethynyluridine)
R language ggplot2 visualization: visualize the line graph and add customized Y-axis label information to the line graph using the labels function
Memo - about C # generating barcode for goods
Three simple methods of ES6 array de duplication
Altair HyperWorks 2022软件安装包和安装教程
实现一个Prometheus exporter
华为游戏初始化init失败,返回错误码907135000
GameFramework食用指南
苹果产品在日本全面涨价,iPhone13涨19%
R language uses the aggregate function of epidisplay package to divide numerical variables into different subsets based on factor variables, and calculate the summary statistics of each subset
Regular expression
[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
Navicat premium 15 permanent cracking and 2021 latest idea cracking (valid for personal testing)
Qt中的QFile读写文件操作
Leetcode-83 delete duplicate elements in the sorting linked list
VBA simple macro programming of Excel
【快应用】Win7系统使用华为IDE无法运行和调试项目
Mipi interface, DVP interface and CSI interface of camera [easy to understand]