NHibernate - From Novice to Competent

מק"ט: #4161 | משך קורס: 24 שעות אק'

A significant portion of today's applications are data centric, however the dominant development paradigm today is the one using object-oriented design.
NHibernate, as an ORM infrastructure, brings together these different approaches and helps us implement our object-modeled Data Access Layer (DAL) using a mature, enterprise-proven infrastructure. Using NHibernate, we can keep using our object-oriented approach, even when dealing with relational databases, bringing the notions of "data" and "code" very close. We can enjoy the benefits of performing amazingly complex queries, from the comfort of our favorite development environment!
Throughout this course the students will learn and experience via exercises various aspects of the NHibernate infrastructure, as well as important "behind the scenes" information such as the built in caching mechanisms and the NHibernate generated SQL – providing all necessary information to build solid DALs and master NHibernate.

הקורס פעיל לקבוצות מטעם ארגונים בלבד, ניתן לשלוח פנייה רק אם מדובר בקבוצה
*שדות חובה
PDF version

קהל יעד

  • .NET Developers


  • Understand the concept of Object Relational Mappers (ORM) and their usage
  • Understand the overall structure of NHibernate and its various components
  • Experience and apply various usage aspects of the NHibernate framework, including advanced scenarios such as bulk queries and the Hibernate Query Language (HQL)

תנאי קדם

  • At least one year of experience in C# development.
  • Familiarity with SQL.

משך הקורס

משך הקורס הינו 24 שעות


Module 1: Introduction to NHibernate

  • What is an ORM?
  • Why use an ORM?
  • NHibernate Overview
  • Advantages of using NHibernate


Module 2: Modeling with NHibernate

  • Model First
    • Using SchemaExport
  • Data Model First approach


Module 3: Hello NHibernate!

  • Mapping an entity
  • Generating the schema
  • CRUD operations using NHibernate
    • Using Criteria API
    • Using LinqToNHibernate
    • Using DetachedCriteria


Module 4: NHibernate Configuration

  • Session factory configuration
    • Dialect
    • Factory class
    • Show SQL and Format SQL
  • Mappings assembly
  • Second-level Caching providers


Module 5: NHibernate Mappings

  • Virtual members and Lazy Loading - quick explanation
    • Id mapping
    • Generator types
  • Composite id
  • Mapping an entity composed of POCO members
    • Mapping entities with inheritance relationship
    • Joined subclass
  • Using a discriminator column
  • Demonstration of Enum mapping
  • Mapping to another mapped member
  • Mapping to a non-mapped class
  • Mapping associations (collections)
    • Types of associations
    • Mapping bags (List)
    • Mapping sets (HashedSet)
    • Mapping Map (IDictionary)


Module 6: Managing Operations

  • The Session Factory
  • Sessions and Transactions
    • The session and the Unit of work pattern
    • Using Transactions
    • Using session with detached entities (Merge and Refresh)


Module 7: CRUD Operations

  • Working with the Criteria API
  • Working with LinqToNHibernate
  • Working with DetachedCriteria
    • Querying an entity’s entity member
    • Projections using DetachedCriteria


Module 8: Fluent NHibernate

  • Mapping entities
  • CRUD Operations
  • Scheme Handling (creation, deletion)


Module 9: Advanced Topics

  • Caching and Second-level caching
  • Hibernate Query Language (HQL)
    • Batched querying
  • Named Queries
  • Using stored procedures
  • Demonstration of Fluent NHibernate
  • Filters
  • Validators
  • Listeners