Nhibernate
This presentation is the property of its rightful owner.
Sponsored Links
1 / 92

NHibernate PowerPoint PPT Presentation


  • 78 Views
  • Uploaded on
  • Presentation posted in: General

NHibernate. Object/Relational Persistence for .NET. A little bit of background information…. .NET port of the Hibernate project (Java). Mature architecture and proven c oncepts, already in use in many enterprise Java applications. Already quite popular in the .NET world as well.

Download Presentation

NHibernate

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


Nhibernate

NHibernate

Object/Relational Persistence for .NET


Nhibernate

A little bit of background information…


Nhibernate

.NET port of the Hibernate project (Java)


Nhibernate

Mature architecture and proven

concepts, already in use in many

enterprise Java applications


Nhibernate

Already quite popular in the .NET world as well


Nhibernate

Popularity seems to be increasing :)


Nhibernate

General Philosophy Of NHibernate


Nhibernate

It’s all about POCO


Nhibernate

Should work on most databases


Nhibernate

As few constraints on your code as possible


Nhibernate

Full OO support: inheritance, polymorphism, composition, single-valued and many-valued associations


Nhibernate

Maximize performance and flexibility


Nhibernate

Keep your code clean


Nhibernate

Strong Points


Nhibernate

Ideally suited for OLTP scenarios (web applications, service layers, …)


Nhibernate

Database independence


Nhibernate

Rich feature set


Nhibernate

Mature


Nhibernate

Extensible architecture


Nhibernate

Large, active, helpful and growing user base


Nhibernate

Plenty of articles, blog posts and documentation available


Nhibernate

It’s Open Source (LGPL)!


Nhibernate

Weak Points


Nhibernate

Not suited (at all) for bulk data processing


Nhibernate

No code generation, and no designer support either


Nhibernate

Bad reputation in some companies due to

lazy coding ( = abuse of lazy loading )


Nhibernate

Plenty of outdated articles, blog posts and documentation available


Nhibernate

It’s Open Source!

(some companies just don’t like that)


Nhibernate

Let’s look at some of the things we can do with NHibernate…


Nhibernate

Transitive Persistence


Nhibernate

Managing associations between classes in a transparent manner


Nhibernate

Allows you to persist object graphs with one instruction


Nhibernate

Needs to be configured for each association

=> fine-grained control over cascade settings


Nhibernate

Hold on… why was every member in the Order

class virtual?


Nhibernate

I wouldn’t want to debug that either :)


Nhibernate

Storing data in the database in an easy manner is great and all, but what about getting it out again?


Nhibernate

Querying with NHibernate


Nhibernate

Hibernate Query Language


Nhibernate

It’s an Object Oriented query language


Nhibernate

Criteria API


Nhibernate

Makes it easier to compose queries dynamically from code.


Nhibernate

LINQ… still not fully supported


Nhibernate

Wouldn’t it be great if we could execute multiple queries in only one database roundtrip?


Nhibernate

Future Queries


Nhibernate

Can we efficiently update multiple records in one roundtrip as well?


Nhibernate

As of NHibernate 2.1, we can do this with some new HQL statements


Nhibernate

Data Modification With HQL


Nhibernate

What about caching? Do we need to do that manually?


Nhibernate

Of course not :)


Nhibernate

Second Level Cache


Nhibernate

Second Level Cache data is available to

allsessions


Nhibernate

We can cache entity instances…


Nhibernate

But we can also cache the results of queries…


Nhibernate

This is ideal for static (reference) data or even data that doesn’t change frequently


Nhibernate

How does the cache deal with modified data, though?


Nhibernate

We’ll update the database and the cache


Nhibernate

NHibernate will never cache anything in the Second Level Cache automatically


Nhibernate

It needs to be configured on a per-entity and per-query basis


Nhibernate

All the caching power you want, without having to pollute your code


Nhibernate

Only use this for data that doesn’t change frequently though


Nhibernate

But where is the cache’s data stored?


Nhibernate

That’s up to you… multiple providers are available: ASP.NET cache, MemCached, Velocity, Prevalence, …


Nhibernate

At this point, I’m almost running out of time and there is a lot more interesting stuff that we won’t get to cover.


Nhibernate

Like optimistic concurrency strategies…


Nhibernate

Or pessimistic locking strategies…


Nhibernate

Or the various identifier strategies…


Nhibernate

Or the various inheritance strategies…


Nhibernate

Or how automatic dirty tracking works…


Nhibernate

Or how you can implement your own dirty tracking…


Nhibernate

Or custom user types…


Nhibernate

Or how to deal with entities that were detached from the session…


Nhibernate

Or the generation of DDL scripts, for your specific database…


Nhibernate

Or the various mapping strategies for complex domain models…


Nhibernate

We didn’t cover any of the many extensibility points either…


Nhibernate

Maybe some other time :)


Nhibernate

If you want to learn more, be sure to visit http://nhforge.org


Nhibernate

Oh, and check out my blog if you liked this presentation: http://davybrion.com


Nhibernate

Questions?


  • Login