We think you have liked this presentation. If you wish to download it, please recommend it to your friends in any social system. Share buttons are a little bit lower. Thank you!
Presentation is loading. Please wait.
Published byHalie Musgrave
Modified over 6 years ago
NHibernate Object/Relational Persistence for.NET
A little bit of background information…
.NET port of the Hibernate project (Java)
Mature architecture and proven concepts, already in use in many enterprise Java applications
Already quite popular in the.NET world as well
Popularity seems to be increasing :)
General Philosophy Of NHibernate
It’s all about POCO
Should work on most databases
As few constraints on your code as possible
Full OO support: inheritance, polymorphism, composition, single-valued and many-valued associations
Maximize performance and flexibility
Keep your code clean
Ideally suited for OLTP scenarios (web applications, service layers, …)
Rich feature set
Large, active, helpful and growing user base
Plenty of articles, blog posts and documentation available
It’s Open Source (LGPL)!
Not suited (at all) for bulk data processing
No code generation, and no designer support either
Bad reputation in some companies due to lazy coding ( = abuse of lazy loading )
Plenty of outdated articles, blog posts and documentation available
It’s Open Source! (some companies just don’t like that)
Let’s look at some of the things we can do with NHibernate…
Managing associations between classes in a transparent manner
Allows you to persist object graphs with one instruction
Needs to be configured for each association => fine-grained control over cascade settings
Hold on… why was every member in the Order class virtual?
I wouldn’t want to debug that either :)
Storing data in the database in an easy manner is great and all, but what about getting it out again?
Querying with NHibernate
Hibernate Query Language
It’s an Object Oriented query language
Makes it easier to compose queries dynamically from code.
LINQ… still not fully supported
Wouldn’t it be great if we could execute multiple queries in only one database roundtrip?
Can we efficiently update multiple records in one roundtrip as well?
As of NHibernate 2.1, we can do this with some new HQL statements
Data Modification With HQL
What about caching? Do we need to do that manually?
Of course not :)
Second Level Cache
Second Level Cache data is available to all sessions
We can cache entity instances…
But we can also cache the results of queries…
This is ideal for static (reference) data or even data that doesn’t change frequently
How does the cache deal with modified data, though?
We’ll update the database and the cache
NHibernate will never cache anything in the Second Level Cache automatically
It needs to be configured on a per-entity and per-query basis
All the caching power you want, without having to pollute your code
Only use this for data that doesn’t change frequently though
But where is the cache’s data stored?
That’s up to you… multiple providers are available: ASP.NET cache, MemCached, Velocity, Prevalence, …
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.
Like optimistic concurrency strategies…
Or pessimistic locking strategies…
Or the various identifier strategies…
Or the various inheritance strategies…
Or how automatic dirty tracking works…
Or how you can implement your own dirty tracking…
Or custom user types…
Or how to deal with entities that were detached from the session…
Or the generation of DDL scripts, for your specific database…
Or the various mapping strategies for complex domain models…
We didn’t cover any of the many extensibility points either…
Maybe some other time :)
If you want to learn more, be sure to visit http://nhforge.org
Oh, and check out my blog if you liked this presentation: http://davybrion.com
Introduction to ECO Malcolm Groves
V 6, Mats Strandberg ORM With Hibernate.
Introduction to NHibernate By Andrew Smith. The Basics Object Relation Mapper Maps POCOs to database tables Based on Java Hibernate. V stable Generates.
A Ridiculously Easy & Seriously Powerful SQL Cloud Database Itamar Haber AVP Ops & Solutions.
An Object/Relational Mapping tool Free and open source Simplifies storage of object data in a relational database Removes the need to write and maintain.
A Workflow Engine with Multi-Level Parallelism Supports Qifeng Huang and Yan Huang School of Computer Science Cardiff University
XStudio Quick Overview Eric Gavaldo
2 A bank application needs to access information from the customer database and integrate it with loan credit history information stored in a legacy database.
Rock Solid Data Access Kevin McKelvin
J-Interop Open Source Java COM Bridge. Contents What is it ? Comparison with Java Native interface Comparison with J-Integra® for COM Benefits of using.
CF and JSP/Servlets Developed originally by Robi Sen For the CF UnderGround II Seminar, Apr 2001 Edited and enhanced by Charlie Arehart (Robi had an emergency.
COM vs. CORBA.
The Top 10 Reasons Why Federated Can’t Succeed And Why it Will Anyway.
.NET Database Technologies: Open-Source Frameworks.
Hibernate 1. Introduction ORM goal: Take advantage of the things SQL databases do well, without leaving the Java language of objects and classes. ORM.
Fast Track to ColdFusion 9. Getting Started with ColdFusion Understanding Dynamic Web Pages ColdFusion Benchmark Introducing the ColdFusion Language Introducing.
Object Relational Mapping. What does ORM do? Maps Object Model to Relational Model. Resolve impedance mismatch. Resolve mapping of scalar and non-scalar.
Session-01. Hibernate Framework ? Why we use Hibernate ?
Slide 1 of 9 Presenting 24x7 Scheduler The art of computer automation Press PageDown key or click to advance.
The POSTGRES Next - Generation Database Management System Michael Stonebraker Greg Kemnitz Presented by: Nirav S. Sheth.
© 2021 SlidePlayer.com Inc. All rights reserved.