O'Reilly logo

NHibernate 3.0 Cookbook by Jason Dentler

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using well-known instance type

Most applications contain some set of static relational data, such as a list of countries, states, credit card types, and others. The application doesn't need to waste time retrieving this static data from the database. It never changes. In this recipe, I'll show you how we can use the well-known instance type from the Unofficial NHibernate AddIns project to avoid this unnecessary work.

How to do it...

  1. Create a new class library project named WKITExample and add a reference to NHibernate.dll.
  2. Add the following GenericWellKnownInstanceType class:
    [Serializable] public abstract class GenericWellKnownInstanceType<T, TId> : IUserType where T : class { private Func<T, TId, bool> findPredicate; private Func<T, TId> idGetter; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required