Questions tagged [fluent-nhibernate]

Fluent NHibernate lets you write NHibernate mappings in strongly typed C# code. This allows for easy refactoring, improved readability and more concise code.

Fluent NHibernate offers an alternative to NHibernate's standard XML mapping files. Rather than writing XML documents (.hbm.xml files), Fluent NHibernate lets you write mappings in strongly typed C# code. This allows for easy refactoring, improved readability and more concise code.

Installation Fluent NHibernate can most easily be installed through its NuGet package.

Install-Package FluentNHibernate

Resources

5486 questions
11
votes
2 answers

Implementing UnitOfWork with Castle.Windsor

Simple question. How do I use UnitOfWork with Castle.Windsor, nHibernate, and ASP.NET MVC? Now for the extended details. In my quest to understand the UnitOfWork pattern, I'm having difficulty coming across anything that uses a direct example in…
Ciel
  • 17,312
  • 21
  • 104
  • 199
11
votes
1 answer

Add a unique constraint on multiple columns with FluentNHibernate

I have a class that has a Primary Key as well as 2 foreign keys. Foreign combinations must be unique. I do not see a way to do this (at least since SetAttribute was deprecated). James touched on this with SetAttribute: How to create a…
sympatric greg
  • 2,969
  • 2
  • 24
  • 29
11
votes
0 answers

Fluent NHibernate - Dialect does not support DbType.Xml (SQLite)

I have a custom NHibernate XMLtype (Converts POCO to XML on the fly) so i can save objects in the DB. This works with SQL Server 2014 without any issues. However, when trying to run our unit tests which use SQLite, I'm getting loads of errors due to…
Ryan Ternier
  • 8,714
  • 4
  • 46
  • 69
11
votes
2 answers

Fluent NHibernate N+1 issue with complex objects

I'm having a problem with NHibernate querying the database way too many times. I just realized it likely relates to the n+1 problem but I can't figure out how to change my mappings to solve the problem. As you will see, my attempts involve…
Morten Salte
  • 505
  • 5
  • 21
11
votes
1 answer

Issue with Casting proxies when using NHibernate table per subclass inheritance strategy

I have got an abstract base class and inherited poco entities. I am using table per subclass inheritance with fluent nhibernate 1.1 automapping. The class inheritance looks like follows Node (abstract class) Place : Node Asset : Node Node class is…
11
votes
1 answer

Anyone know of any decent resources on Stored Procedures for Fluent Nhibernate 1.1

A recent release of Fluent Nhibernate (1.1) now supports stored procedures. I was wondering if anyone out there has found any good blog articles on how to do this! I am not asking about using classic hbm mappings instead which these questions…
Aim Kai
  • 2,934
  • 1
  • 22
  • 34
11
votes
2 answers

Mapping a Component inside a Component Collection

I'm trying to map a value object collection where these contain other value objects but am getting the below exception. nHibernate Exception: ----> NHibernate.PropertyNotFoundException : Could not find a getter for property '_timeAtAddress' in…
11
votes
2 answers

Fluent NHibernate - How to map a non nullable foreign key that exists in two joined tables

I'm mapping a set of membership classes for my application using Fluent NHibernate. I'm mapping the classes to the asp.net membership database structure. The database schema relevant to the problem looks like this: ASPNET_USERS UserId …
vakman
  • 494
  • 4
  • 12
11
votes
3 answers

Named query not known error trying to call a stored proc using Fluent NHibernate

I'm working on setting up NHibernate for a project and I have a few queries that, due to their complexity, we will be leaving as stored procedures. I'd like to be able to use NHibernate to call the sprocs, but have run into an error I can't figure…
Hamman359
  • 1,052
  • 2
  • 14
  • 27
11
votes
2 answers

How do I make NUnit respect my bindingRedirect in my testassembly.dll.config?

I am using the 1.0 RTM of Fluent Nhibernate, with a 3.0 build of NHibernate. In order to do this, I need to add the following to my .config file:
JohnRudolfLewis
  • 1,692
  • 1
  • 18
  • 33
11
votes
3 answers

What is the difference between a nhibernate query cache and entity cache when using second level caching?

I am trying to setup nhibernate second level caching and i see in this article, and i am trying to understand the difference between query caching and entity caching. It says you need to add Cache.ReadOnly(); or Cache.ReadWrite(); on every…
leora
  • 188,729
  • 360
  • 878
  • 1,366
11
votes
2 answers

Use of TransactionScope with read uncommitted - is with (nolock) in SQL necessary?

I am using FluentNHibernate, and I have a list of records, mapped to an SQL Server 2008 view. Dirty reads are OK with me, not locking the tables is a priority. The SQL Query inside the view, does not have any with (nolock), however, I am using the…
Mez
  • 4,666
  • 4
  • 29
  • 57
11
votes
6 answers

Using MVC and fluent Nhibernate, how do I validate unique fields on my ViewModel before I bind them to my Domain Object and Save them?

I have a website where I allow users to create new Part records. I'm trying to figure out the best way to validate specific fields for uniqueness. I want to make sure that somebody doesn't try to add a Part with PartNumber 1234 if that PartNumber…
11
votes
3 answers

fluent nhibernate r1.0 fluent mapping disable lazy load

how to disable lazy loading in fn r1.0?
Chen Kinnrot
  • 20,609
  • 17
  • 79
  • 141
11
votes
1 answer

Antlr exception with message "plan b" when walking IQueryable of NHibernate entities

I've got quite weird exception when trying to materialize the IQueryable I got form NHibernate.Linq. The exception of type Antlr.Runtime.Tree.RewriteEmptyStreamException just states plan b, and nothing more. Detailed exception can be found at…
J0HN
  • 26,063
  • 5
  • 54
  • 85