当前位置:网站首页>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 .
边栏推荐
- 搭建一個通用監控告警平臺,架構上需要有哪些設計
- What designs are needed in the architecture to build a general monitoring and alarm platform
- Why do independent website sellers start to do social media marketing? The original customer conversion rate can be improved so much!
- lefse分析
- Go Technology Daily (2022-02-14) - go language slice interview real questions 8 consecutive questions
- Lumiprobe 自由基分析丨H2DCFDA说明书
- R语言ggplot2可视化:gganimate包transition_time函数创建动态散点图动画(gif)、shadow_wake函数配置动画的渐变效果(gradual falloff)拖尾效应
- 助力数字经济发展,夯实数字人才底座—数字人才大赛在昆成功举办
- ES6数组方法find()、findIndex()的总结「建议收藏」
- Lumiprobe non fluorescent alkyne EU (5-ethynyluridine)
猜你喜欢
研究了11种实时聊天软件,我发现都具备这些功能…
Basic knowledge and commands of disk
ACM mm 2022 video understanding challenge video classification track champion autox team technology sharing
11、用户、组和权限(1)
中英说明书丨人可溶性晚期糖基化终末产物受体(sRAGE)Elisa试剂盒
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
用WPF写一款开源方便、快捷的数据库文档查询、生成工具
华为云专家详解GaussDB(for MySQL)新特性
Clean up system cache and free memory under Linux
Lumiprobe biomolecular quantification - qudye Protein Quantification Kit
随机推荐
Create your own NFT collections and publish a Web3 application to show them (Introduction)
Golang error handling
前4A高管搞代运营,拿下一个IPO
如何运营好技术相关的自媒体?
How to realize the bottom layer of read-write lock in go question bank 16
11、用户、组和权限(1)
ES6数组去重的三个简单办法
ES6数组方法find()、findIndex()的总结「建议收藏」
app发版后的缓存问题
Memo - about C # generating barcode
摄像头的MIPI接口、DVP接口和CSI接口[通俗易懂]
Intensive cultivation of channels for joint development Fuxin and Weishi Jiajie held a new product training conference
搭建一个通用监控告警平台,架构上需要有哪些设计
研究了11种实时聊天软件,我发现都具备这些功能…
【AGC】如何解决事件分析数据本地和AGC面板中显示不一致的问题?
Image acquisition and playback of coaxpress high speed camera based on pxie interface
Huawei game failed to initialize init with error code 907135000
网易游戏,激进出海
Three simple methods of ES6 array de duplication
Qfile read / write file operation in QT