![]() | CYQ.Data componentsCYQ.Data support multi-database application [Txt,Xml,Access, MSSQL, Oracle,SQLite,MySql], help easily and quickly to develop your project |
CYQ.Data 数据框架 实现数据的按需更新的改进--用数据对比进一步说明
Principles |
|
|
| #TopicOwner |
在发布完:框架设计:实现数据的按需更新与插入的改进, 有网友表示不理解,于是这里给出一篇简单的说明对比,表示下改进后好处。 一:场景一:循环5次,同样也是重复提交的问题 using (MAction action = new MAction(TableNames.Blog_User))
{ for (int i = 0; i < 5; i++) { action.Set(Users.ID, 18); action.Set(Users.UserName, "cyq1162"); action.Update(); } Response.Write(action.DebugInfo);//输出调试信息 } 1:旧模式生成的SQL: 说明: 我们很直观的看到它重复的更新了5次。
2:改进后生成的SQL: 说明: 改进后,只是更新一次,其它四次并没有操作数据库。
二:场景二:模块缓存场景,其实和第一场景相似 MDataRow userInfo=null;//模拟行数据缓存
using (MAction action = new MAction(TableNames.Blog_User)) { if (action.Fill(18)) { userInfo = action.Data; } } using (MAction action = new MAction(userInfo))//从缓存加载 { action.Set(Users.UserName, "cyq1162"); action.Update(); Response.Write(action.DebugInfo); } 1:旧模式生成的SQL: ![]() 说明: 无论存不存在缓存,更新同样被触发。
2:改进后生成的SQL: 说明: 有缓存数据时,相同的数据更新,则不会再被更新。
三:结论好处 实质性的减少数据库操作,从数据框架底层有效的防止无效的点击事件。 ![]() |
Post Comment
Bulletin
Article Search
Categories
- Platform for dynamic (20)
- Feedback (9)
- Guide (33)
- Principles (19)
- Project-Case (8)
- Business & Buy (2)
- Technology exchange (45)
New Article
- CYQ.Data Components Getting Started Guide [Part 5]-[MProc Execute Stored Procedures or SQL]
- CYQ.Data Components Getting Started Guide [Part 4]-[MAction Insert Delete Update]
- CYQ.Data Components Getting Started Guide [Part 3]-[MAction Get And Set Value]
- CYQ.Data Components Getting Started Guide [Part 2]-[MAction Data Query- Fill And Select]
- CYQ.Data Components Getting Started Guide [Part 1]
New Comment
- When some one searches for his necessary thing, therefore he/she wishes to be available that in detail, so that thing is maintained over here.
- This is my first time pay a quick visit at here and i am in fact happy to read everthing at alone place.
- I truly appreciate this blog article.Really thank you! Cool.
- please pay a visit to the web sites we follow, like this one particular, as it represents our picks in the web
- Really enjoyed this post.Really thank you!
- Really enjoyed this article.Really looking forward to read more. Great.
- poker bonuses What are the norms of copyright of web content? How as it different from Patent?
- Wow! Thank you! I permanently needed to write on my blog something like that. Can I implement a fragment of your post to my site?
- This website was how do I say it? Relevant!! Finally I ave found something that helped me. Cheers!
- I was reading through some of your content on this internet site and I believe this web site is very informative ! Continue posting.