Giter Site home page Giter Site logo

thomaswdonnelly / nhibernate-by-example Goto Github PK

View Code? Open in Web Editor NEW

This project forked from davidwhitney/nhibernate-by-example

0.0 1.0 0.0 1.43 MB

NHibernate talk on quickly getting it right, and how you can get it dramatically wrong.

License: MIT License

C# 53.82% CSS 1.90% ASP 0.29% HTML 14.23% JavaScript 29.75%

nhibernate-by-example's Introduction

NHibernate by example

Part 1 - The pit of success

Sesssion management

  • JUST ONE SESSION FACTORY (per tenant ;) )

  • Scoping! There's lots of information on the web, but the right answer is to use your container.

  • Session per request

  • using flush (don't call flush explicitly!)

  • not committing transactions

Modeling

  • Map your aggregate roots correctly

Mapping

  • Make sure you get the right Id pattern
  • Increment is SINGLE INSTANCE ONLY.
  • Beware enums and dirty flags
  • Yes, you really have to mark everything as virtual, including unrelated methods

Understanding the NHibernate cache

Talking about repositories

  • NHibernate is one, so don't wrap it.

Querying

  • Query over
  • ICriteria
  • Linq
  • Encapsulate queries, not "ISession", CQRS-ish.

Part 2 - Querying, code hygine, advanced topics

N+1 and other foibles

  • Beware lazy loading - user "Fetch"
  • But don't disable lazy loading

Advanced Queries

  • Fetch modes
  • Projections
  • HQL
  • Multi-queries / Futures / Batching

Advanced mapping

  • Composite type mappings make your ugly tables a little nicer
  • Mapping expressions

Interceptors and events

  • Use the framework to bridge the gulf of model / storage details (encryption, weird data mapping problems)

nhibernate-by-example's People

Contributors

davidwhitney avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.