• Like
我对ORM的思考
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

我对ORM的思考

  • 355 views
Published

 

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
355
On SlideShare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
3
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide









































Transcript

  • 1. ORM
  • 2. Why ORM?
  • 3. Why ORM? •
  • 4. Why ORM? • • SQL
  • 5. Why ORM? • • SQL
  • 6. Why ORM? • • SQL •
  • 7. O - Object
  • 8. O - Object •
  • 9. O - Object • • Admin inherits User ?
  • 10. R - Relational
  • 11. R - Relational • CRUD
  • 12. R - Relational • CRUD • 3NF
  • 13. R - Relational • CRUD • 3NF •
  • 14. M - Mapping
  • 15. M - Mapping • O => R ?
  • 16. M - Mapping • O => R ? • R => O ?
  • 17. R=>O • •
  • 18. ActiveRecord • • •
  • 19. • ORM = •
  • 20.
  • 21. • •
  • 22. • •
  • 23. • • •
  • 24. N + 1 VS 1
  • 25. N + 1 VS 1 • select * from blogs
  • 26. N + 1 VS 1 • select * from blogs
  • 27. N + 1 VS 1 • select * from blogs
  • 28. N + 1 VS 1 • select * from blogs • select id from blogs
  • 29. N + 1 VS 1 • select * from blogs • select id from blogs • select * from blogs where id=X
  • 30. • Objects • Lists
  • 31. • FetchById
  • 32. • FetchById •
  • 33. • FetchById • •
  • 34. • FetchById • •
  • 35. • FetchById • • • FetchByIds
  • 36. • select * from blogs where user_id = XXX order by id desc •
  • 37. • where column1 = XXX • and column2=YYY • order by id desc • count(*)
  • 38. • Query q = Blogs.Query(); • q.AddWhere(“user_id”, XXX); • q.OrderBy(“id”, “desc”); • q.Start = 0; • q.count = 10; • q.ExecuteIds();
  • 39. • Query q = Blogs.Query(); • .... • q.CountIds();
  • 40.
  • 41.
  • 42. • •
  • 43. • • • Delete by old value
  • 44. • • • Delete by old value • Add by new value
  • 45. • • •
  • 46. • SubSonic http://subsonicproject.com/ • Cache Money http://github.com/nkallen/ cache-money • PEAA http://book.douban.com/subject/ 1230559/