Devart Blog

NHibernate

String Enum Representation in Entity Developer

Posted by on November 17th, 2014

This article explains and demonstrates mapping a string representation of enum to string fields in a database in Entity Developer. The sample, demonstrated in this post, is included into our NHibernate Mapping Samples application, described in the corresponding NHibernate Mapping Samples blog article. It is named ‘Enum Type Property'; however, other samples from this application probably prove to become useful for NHibernate users both beginners and professionals, so we recommend downloading it for everyone who develop NHibernate applications.

The problem with mapping enum types in NHibernate is that NHibernate can map enum type values only to the numeric columns in database without additional manipulations. However, when enum values are stored in database as strings, NHibernate requires the user to perform some additional actions.
(more…)

NHibernate Mapping Samples – 50 Samples of NHibernate Mapping

Posted by on July 18th, 2012

NHibernate is a widely used open-source ORM solution for .NET Framework. It is well-known for its great flexibility in mapping .NET classes to database tables, because it supports most kinds of such mapping ever needed by developers. However, its is also well-known for its complex mapping both fluent and XML. To help beginner developers to get acquainted with NHibernate mapping, Devart releases NHibernate Mapping Samples application, which demonstrates 50 different mapping cases and how they are mapped using both fluent and XML mapping.

(more…)

Support of Many-to-One Mapping for Component Navigation Properties in Entity Developer

Posted by on May 24th, 2012

This article explains and gives a practical example of how support of сomponent navigation properties is implemented in Entity Developer for NHibernate.
Support of this functionality includes the possibility of detaching to a complex type for further reusability not only scalar entity properties but also navigation properties with subsequent customization of complete mapping at the level of private mapping of a certain property with type equal to complex type of a certain entity.

There are several ways of component navigation properties mapping in NHibernate:

  • Many-to-one;
  • One-to-many;
  • One-to-one;
  • Many-to-many.

In this article we will consider the most popular of them, i.e. many-to-one mapping of сomponent navigation properties. We will not focus on one-to-many and one-to-one types of сomponent navigation properties mapping, as these types of mapping are not very common, besides, their usage and customization have little difference from the example under consideration and so are quite comprehensible. Many-to-many mapping is considered in details in the article Support of Many-to-Many Mapping for Component Navigation Properties in Entity Developer.
(more…)

Support of Many-to-Many Mapping for Component Navigation Properties in Entity Developer

Posted by on May 24th, 2012

This article explains and gives a practical example of how support of сomponent navigation properties is implemented in Entity Developer for NHibernate.
Support of this functionality includes the possibility of detaching to a complex type for further reusability not only scalar entity properties but also navigation properties with subsequent customization of complete mapping at the level of private mapping of a certain property with type equal to complex type of a certain entity.

There are several ways of component navigation properties mapping in NHibernate:

  • Many-to-one;
  • One-to-many;
  • One-to-one;
  • Many-to-many.

In this article we will consider many-to-many mapping of сomponent navigation properties.
To find out more about the rest of the types of сomponent navigation properties mapping, see the article devoted to them here.
(more…)

Сomponent Сollections Support in Entity Developer

Posted by on May 24th, 2012

This article explains and gives a practical example of how support of сomponent collections is implemented in Entity Developer for NHibernate. You can take a close look at this type of mapping in the NHibernate documentation here.
This article contains examples of mapping for the following associations:

  • Classic mapping of component collections;
  • A special case of component collections mapping for a many-to-many association.

(more…)

NHibernate and Oracle Database via dotConnect

Posted by on March 24th, 2010

NHibernate is an ORM solution moved from Java to Microsoft .NET. It allows mapping application objects to relational database. NHibernate automatically generates SQL code for loading and saving objects. One of the approaches of NHibernate usage is entity mapping XML definition.

In this article we will talk about interaction of NHibernate with Oracle 11g. To establish connection to this database we will use the Devart dotConnect for Oracle provider built on ADO.NET technology to develop Oracle-based database applications.
(more…)