Fluent NHibernate Composite Key Many-to-Many

Summary I’m on a roll today, so I decided to create a new connection table between my Class table and Student table in my previous blog posts. This table is identical to the StudentClass table, except I removed the primary key and used only two fields and made them into a composite key. If you’re … Read moreFluent NHibernate Composite Key Many-to-Many

Fluent NHibernate: Removing a Relationship Connection From a Many-to-Many

In my last blog post I forgot to show how to disconnect a student from a class but leave both the student and the class records intact. So I quickly ninja’d something together to demonstrate how simple it is to perform this vital function. Here’s my code: First, I queried for the student I wished … Read moreFluent NHibernate: Removing a Relationship Connection From a Many-to-Many

Fluent NHibernate HasManyToMany the Normal Way

Summary As I mentioned in my last blog post, there is a simple way to treat a many-to-many data relationship involving basic mapping and handling the connection using the LINQ query itself. Now I’m going to show how the many-to-many mapping occurs involving more mapping commands and one less table (the connecting table called StudentClass). … Read moreFluent NHibernate HasManyToMany the Normal Way

Fluent NHibernate Many-to-Many Without Using HasManyMany

SummaryIn my last Fluent NHibernate post I showed how to do a One-to-Many mapping using the HasMany mapping method and ILists.  Getting the mappings to work correctly was a bit painful, and the outcome was questionable.  So I thought I’d try my hand at mapping a many-to-many situation without using the HasManyToMany mapping method or … Read moreFluent NHibernate Many-to-Many Without Using HasManyMany

Fluent NHibernate HasMany Mapping

Summary This post will demonstrate how a one-to-many mapping can be done in Fluent NHibernate. As in previous articles, I’m going to use my facultydata database with two tables to demonstrate the HasMany and References mappings. The Database First, we’ll need to make sure that both tables have primary keys. Then add a foreign key … Read moreFluent NHibernate HasMany Mapping

Fluent NHibernate Unit Testing Using SQLite

Summary So I’ve been producing a lot of blog posts on NHibernate lately. I’m attempting to evaluate NHiberate against other ORMs like Entity Framework. This blog post will focus no basic unit testing of NHibernate. I’m using Fluent with my NHibernate, but much of this knowledge still applies to straight NHibernate. SQLite Before I started … Read moreFluent NHibernate Unit Testing Using SQLite

Fluent NHibernate Stored Procedure

Summary This week I’m going to give a very simple example of how to execute a stored procedure.  The stored procedure will only do a select query, but I’ll pass a variable to demonstrate how it’s done and I’ll leave it up to the reader to alter the code to execute other types of stored … Read moreFluent NHibernate Stored Procedure

Fluent NHibernate Using Multiple Database

Summary This time I’m going to show how to use tables from two different databases in one context. It’s difficult to find information on this subject and many links point to an article that uses a dictionary of context’s with all kinds of fancy configuration and code to map things. After an hour of hunting … Read moreFluent NHibernate Using Multiple Database

Entity Framework 6 vs. NHibernate smackdown!

It’s time for a performance test between EF-6 and NHibernate.  Previously I did a smackdown between EF-6 and LINQ-to-SQL (see this article: Entity Framework 6 vs. LINQ-toSQL smackdown!).  This time I’m going to show the performance of inserts between EF-6 and NHibernate. I used the same tables and data as in the previous blog posting. … Read moreEntity Framework 6 vs. NHibernate smackdown!

Fluent NHibernate with MS SQL Server

Summary I’m currently researching all my options regarding ORM’s. In my previous posts I talked about NHibernate and how to setup a simple example. This time I’m going to demonstrate how Fluent NHibernate works and how you can use it to avoid setting up xml documents for mapping your tables. Project Setup Create an empty … Read moreFluent NHibernate with MS SQL Server