Category: ActiveRecord

ActiveRecord ICriterion Search Example (c#)

In this post we are going to search using ICriterion to filter and sort the results. The only pre-requisite is that you properly configure your nHibernate environment, and like all my other code samples, know c#. This one is pretty easy, first we are going to set the required references: Then we are going to [...]

January 14 / 2010
Author bill sternberger
Comments No Comments

Codesmith Templates for nHibernate and ASP.NET MVC

Reason #52356 I love using Castle’s ActiveRecord is that CRUD is automatically handled for you, which is a major time saver. I’m always looking for any edge to speed up the development process or automate redundant tasks, and that little drive led me to Codesmith Tools. What’s so cool about Codesmith? The fact that once [...]

January 10 / 2010

Initialize global asax in MVC for NHibernate ActiveRecord

Initializing your global.asax for MVC and NHibernate’s ActiveRecord is really easy. There are really only two sections you need to touch: the using section and Application_Start(). Configure using section Out of the box, you don’t have to do anything if you are NOT using ActiveRecord for CRUD. If you want to use ActiveRecord, here are [...]

January 09 / 2010
Author bill sternberger
Comments 1 Comment

How to execute a Query in c# using nHibernate, ICriterion, HQL

Below are two samples on how to create a query with ActiveRecord and ICriterion. Example 1: Select all contacts from Texas The Controller’s syntax would be this: Example 2: SQL style query The next part is where all the magic happens. The “SELECT” part is done for us automatically, so we simply add our WHERE [...]

December 06 / 2009
Author bill sternberger
Comments No Comments

How To Create a Class with ActiveRecord

How to create a custom query using NHibernate and ActiveRecord

December 06 / 2009
Author bill sternberger
Comments No Comments