Fluent NHibernate - Fluent mapping for model

  •        0

Fluent, XML-less, compile safe, automated, convention-based mappings for NHibernate. Fluent NHibernate offers an alternative to NHibernate's standard XML mapping files. Rather than writing XML documents, you write mappings in strongly typed C# code. This allows for easy refactoring, improved readability and more concise code.

Why replace HBM.XML? While the separation of code and XML is nice, it can lead to several undesirable situations.

  • Due to XML not being evaluated by the compiler, you can rename properties in your classes that aren't updated in your mappings; in this situation, you wouldn't find out about the breakage until the mappings are parsed at runtime.
  • XML is verbose; NHibernate has gradually reduced the mandatory XML elements, but you still can't escape the verbosity of XML.
  • Repetitive mappings - NHibernate HBM mappings can become quite verbose if you find yourself specifying the same rules over again. For example if you need to ensure all string properties mustn't be nullable and should have a length of 1000, and all ints must have a default value of -1.

How does Fluent NHibernate counter these issues? It does so by moving your mappings into actual code, so they're compiled along with the rest of your application; rename refactorings will alter your mappings just like they should, and the compiler will fail on any typos. As for the repetition, Fluent NHibernate has a conventional configuration system, where you can specify patterns for overriding naming conventions and many other things; you set how things should be named once, then Fluent NHibernate does the rest.

Its feature includes:
  • Auto mappings - where mappings are inferred from the design of your entities
  • Persistence specification testing - round-trip testing for your entities, without ever having to write a line of CRUD
  • Full application configuration with our Fluent configuration API
  • Database configuration - fluently configure your database in code




comments powered by Disqus

Related Projects

NHibernate - object-relational mapper for .NET

NHibernate is a mature, open source object-relational mapper for the .NET framework. NHibernate is a port of Hibernate Core for Java to the .NET Framework. It handles persisting plain .NET objects to and from an underlying relational database.


SQLAlchemy is the Python SQL toolkit and Object Relational Mapper that gives application developers the full power and flexibility of SQL. It provides a full suite of well known enterprise-level persistence patterns, designed for efficient and high-performing database access, adapted into a simple and Pythonic domain language.

Doctrine ORM - Object relational mapper for PHP

Object relational mapper (ORM) for PHP that sits on top of a powerful database abstraction layer (DBAL). One of its key features is the option to write database queries in a proprietary object oriented SQL dialect called Doctrine Query Language (DQL), inspired by Hibernates HQL. This provides developers with a powerful alternative to SQL that maintains flexibility without requiring unnecessary code duplication.

Propel - smart easy object persistance in PHP

Propel is an open-source Object-Relational Mapping (ORM) for PHP5. It allows you to access your database using a set of objects, providing a simple API for storing and retrieving data. Propel uses PDO as an abstraction layer, and code generation to remove the burden of runtime introspection. Therefore Propel is fast.

BL-Toolkit - Business Logic Toolkit for .NET

Business Logic Toolkit is a set of components to simplify .NET application development. BLToolkit is provided as source code that you can use "as is" or customize for your applications. It is written in C# and compatible with .NET Framework 3.5 and 4.0.

Dapper-dot-net - Simple SQL object mapper for ADO.NET

Dapper - a simple object mapper for .Net. It is a single file you can drop in to your project that will extend your IDbConnection interface. Dapper's default behavior is to execute your sql and buffer the entire reader on return. This is ideal in most cases as it minimizes shared locks in the db and cuts down on db network time.

nHydrate - Conceive, Model, Generate

nHydrate is an object-relational mapping (ORM) solution for the Microsoft .NET platform providing a framework for a relational database to be mapped to .NET objects. It is designed to alleviate the software developers experience writing persistence domains. The model controls database generation, LINQ syntax, API, DAL, etc.

SubSonic - Data access for .NET

SubSonic is A Super High-fidelity Batman Utility Belt that works up your Data Access (using Linq in 3.0), throws in some much-needed utility functions, and generally speeds along your dev cycle.

Outlet - object-to-relational mapping for PHP

Outlet differs from other orm solutions for php in that it provides transparent, unobtrusive persistence. It does not require your entity objects to implement any interfaces or extend some sort of base class. It is also very lightweight, only a handful of classes and tools.

RedBeanPHP - Easiest ORM layer for php

RedBeanPHP is an open source ORM (object relational mapping) tool for PHP. It focuses on simplicity and ease of use. What makes RedBean unique is that it creates your database schema on-the-fly. It scans your data and adjusts the column types to fit your object properties. If your models are stabilized you can freeze the database. This way RedBean is easy to develop with but is also extremely fast on production servers.

Open source products are scattered around the web. Please provide information about the open source projects you own / you use. Add Projects.

Tag Cloud >>