slide1 n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Become the nhibernate Guru PowerPoint Presentation
Download Presentation
Become the nhibernate Guru

Loading in 2 Seconds...

play fullscreen
1 / 51

Become the nhibernate Guru - PowerPoint PPT Presentation


  • 100 Views
  • Uploaded on

Become the nhibernate Guru. Torkel Ödegaard. torkel.odegaard@gmail.com. www.codinginstinct.com. Nhibernate?. ORM (Object-Relational Mapper). Transparent persistance. Persistence ignorance. Become the Guru. Identity map (L1 Cache) Unit Of Work (Session Flush) Cascading

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Become the nhibernate Guru' - cassandra-wooten


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
slide2

Torkel Ödegaard

torkel.odegaard@gmail.com

www.codinginstinct.com

nhibernate
Nhibernate?

ORM (Object-Relational Mapper)

Transparent persistance

Persistence ignorance

become the guru
Become the Guru
  • Identity map (L1 Cache)
  • Unit Of Work (Session Flush)
  • Cascading
  • Attached / Detached
  • Proxy / Lazy loading
  • ID generation / unsaved-value
  • Concurrency
  • Legacy databases
  • Performance
u nit of work
unit of work

session.Flush()

flush mode
Flush Mode
  • Auto
  • Commit
  • Never
  • Unspecified
transaction
Transaction

Unit Of Work

identity map
identity map

An identity map is a database access design pattern 

used to improve performance by providing a context-specific

in-memory cache to prevent duplicate retrieval of the same

object data from the database.

identity map problems
identity map - Problems

Same instance

Will return instance from identity map

identity map problems1
identity map - Problems

NHibernate.NonUniqueObjectException

A different object with the same identifier value was already associated with the session

Two instances with same id

identity map problems2
identity map - Problems

NHibernate.HibernateException

Identifier of an instance of TieFighter was altered …

cascading1
cascading
  • None
  • Save-update
  • Delete
  • Delete-orphan
  • All
  • All-delete-orphan
cascade save update
Cascade & Save-update

Transient (unsaved) instance

Transient (unsaved) instance

INSERT INTO Pilot ....

INSERT INTO TieFighter ...

cascade delete
Cascade & delete

DELETE TieFighter ...

DELETE Pilot ...

cascade none
Cascade & none

Transient (unsaved) instance

Transient (unsaved) instance

NHibernate.TransientObjectException

Object references an unsaved transient instance -save the transient instance before flushing

cascade none3
Cascade & none

UPDATE Pilot ....

legacy
legacy
  • Composite primary keys
  • Relations on non-primary keys
  • Join
  • SQL Queries
  • DB Generated fields
performance
performance
  • Batching
  • Eager loading (eliminate N+1)
  • Query Cache
  • L2 Cache
i could go on an on
i could go on an on...
  • NHibernate = endless number of features 
resources
resources
  • http://nhforge.org/
  • http://ayende.com/blog
  • http://www.codinginstinct.com
  • http://sharparchitecture.net/

Torkel.odegaard@gmail.com

http://tlo.googlecode.com/svn/trunk/presentations/nhibernate_elevate