O'Reilly logo

NHibernate 4.x Cookbook - Second Edition by Jason Dentler, Alexander Zaytsev, Gunnar Liljas

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 types

Most applications contain a set of static relational data, such as a list of countries, states, credit card types, and others. The application does not need to waste time retrieving this static data from the database; it never changes. In this recipe, we will show you how you 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.
  2. Install the NHibernate package using the NuGet Package Manager Console by executing the following command:
    Install-Package NHibernate
    
  3. Add the following GenericWellKnownInstanceType class:
    [Serializable] public abstract class GenericWellKnownInstanceType<T, TId> IUserType ...

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