当前位置:网站首页>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 .
边栏推荐
- 实例讲解将Graph Explorer搬上JupyterLab
- How does factor analysis calculate weights?
- Taiaisu M source code construction, peak store app premium consignment source code sharing
- Halcon图片标定,使得后续图片处理过后变成与模板图片一样
- R语言ggplot2可视化:gganimate包transition_time函数创建动态散点图动画(gif)、shadow_wake函数配置动画的渐变效果(gradual falloff)拖尾效应
- 中英说明书丨人可溶性晚期糖基化终末产物受体(sRAGE)Elisa试剂盒
- 11、用户、组和权限(1)
- How to operate technology related we media well?
- Clean up system cache and free memory under Linux
- Navicat premium 15 permanent cracking and 2021 latest idea cracking (valid for personal testing)
猜你喜欢

Leetcode-141 circular linked list

Huawei cloud experts explain the new features of gaussdb (for MySQL)

如何使用物联网低代码平台进行个人设置?

网易游戏,激进出海

Lumiprobe 生物分子定量丨QuDye 蛋白定量试剂盒

微服务大行其道的今天,Service Mesh是怎样一种存在?

Case study on comprehensive competitiveness of principal components

隐私沙盒终于要来了

Basic knowledge and commands of disk

What designs are needed in the architecture to build a general monitoring and alarm platform
随机推荐
如何运营好技术相关的自媒体?
【快应用】text组件里的文字很多,旁边的div样式会被拉伸如何解决
app发版后的缓存问题
苹果产品在日本全面涨价,iPhone13涨19%
如何运营好技术相关的自媒体?
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
Halcon image calibration enables subsequent image processing to become the same as the template image
如何在自有APP内实现小程序实现连麦直播
Golang error handling
2. Create your own NFT collections and publish a Web3 application to show them start and run your local environment
Lefse analysis
R language uses the transmute function of dplyr package to calculate the moving window mean value of the specified data column in dataframe data, and uses ggplot2 package to visualize the line graph b
用WPF写一款开源方便、快捷的数据库文档查询、生成工具
R语言caTools包进行数据划分、scale函数进行数据缩放、class包的knn函数构建K近邻分类器、table函数计算混淆矩阵
Lumiprobe 生物分子定量丨QuDye 蛋白定量试剂盒
微服务大行其道的今天,Service Mesh是怎样一种存在?
毕业季 | 华为专家亲授面试秘诀:如何拿到大厂高薪offer?
Must see, time series analysis
Lumiprobe非荧光炔烃丨EU(5-乙炔基尿苷)
ACM MM 2022视频理解挑战赛视频分类赛道冠军AutoX团队技术分享