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
16
votes
2 answers

NHibernate OutOfMemoryException querying large byte[]

I'm trying to use Fluent NHibernate to migrate a database that needs some of the database 'massaged'. The source database is a MS Access database and the current table I'm stuck on is one with an OLE Object field. The target database is a MS SQL…
Mark E
  • 371
  • 2
  • 12
16
votes
3 answers

Enum parsing doesn't seem to work with Fluent NHibernate

I have a data access class with an Enum called Salutation: public enum Salutation { Unknown = 0, Dame = 1, etc Mr = 5, etc } I am peristing the class with NHibernate, and up until this morning I was using .hbm.xml files for…
David
  • 15,750
  • 22
  • 90
  • 150
16
votes
3 answers

Fluent NHibernate Column Mapping with Reserved Word

I've read that using a back tick ` should allow for using of reserved words. I'm using SQL Server and Fluent NHibernate and have a column name "File". If I map it with "`File" it tries using [Fil] so it's adding the brackets correctly, but…
Josh Close
  • 22,935
  • 13
  • 92
  • 140
16
votes
3 answers

Failed to serialize the response body for content type

I'm building a MVC4 application that uses both Controllers and ApiControllers. I modified the default Web API route to include action names. When I try to get a list of Benchmarks, I'm getting this error message: The 'ObjectContent`1' type failed…
Astaar
  • 5,858
  • 8
  • 40
  • 57
15
votes
2 answers

How to create a Multi-Column Index or Unique Constraint with NHibernate

How to create a Multi-Column Index and/or Unique Constraint using NHibernate Mapping or Fluent NHibernate.
Wahid Shalaly
  • 2,047
  • 1
  • 18
  • 29
15
votes
5 answers

NHibernate component mapping - Null Component

I have a mapped entity, Matter, that has a mapped component, Injury. The only property on the Injury is DateOfInjury which is a nullable datetime. When I retrieve the Matter, if the DateOfInjury is null, the component is null. Thus something like…
byron
15
votes
1 answer

nHibernate HQL - entity is not mapped

I have my nHibernate setup and working correctly with QueryOver for most queries, however, whenever I try to do a HQL CreateQuery I get the exception that the entity isn't mapped. I can confirm that the same entity works fine using QueryOver. Note:…
johnnyboy
  • 869
  • 12
  • 23
15
votes
1 answer

Fluent NHibernate one to many uni-directional mapping

I have Post and Comment classes, and they have a one to many relationship where Post has a list of Comments. How can I map this as a uni-directional relationship with Fluent NHibernate, since a comment does not need to know its parent Post? …
Relleum
15
votes
4 answers

Is it possible to use NHibernate without altering a DDD model that is part of a framework

I dig a lot of things about the DDD approach (Ubiquitous language, Aggregates, Repositories, etc.) and I think that, contrary to what I read a lot, entities should have behavior rather then being agnostic. All examples I see tend to present entities…
W3Max
  • 3,328
  • 5
  • 35
  • 61
14
votes
2 answers

NHibernate Fluent vs. Attributes

I'm interested in moving some NHibernate configurations/mappings into the code to help with some maintenance issues. Can anyone provide any advice/pros/cons/comparisons of Fluent NHibernate vs. NHibernate.Mapping.Attributes? I have some experience…
Andy White
  • 86,444
  • 48
  • 176
  • 211
14
votes
3 answers

which version of fluent nhibernate is compatible with nhibernate 3.2

i see when i install fluent nhibernate 1.2 from Nuget, it downloads nhibernate 3.1. If i want to use nhibernate 3.2, how would i do that through nuget and it is compatible with fluent nhibernate 1.2 ?
leora
  • 188,729
  • 360
  • 878
  • 1,366
14
votes
2 answers

Castle Windsor IoC in an MVC application

Prepare for a wall of code... It's a long read, but it's as verbose as I can get. In response to Still lost on Repositories and Decoupling, ASP.NET MVC I think I am starting to get closer to understanding this all. I'm trying to get used to using…
Ciel
  • 17,312
  • 21
  • 104
  • 199
14
votes
3 answers

Is there any Fluent NHibernate book?

Taking into consideration that Fluent NHibernate has been available for some time I thought that there would be a book available already so i search in amazon and in google but there is no books for fluent nhiberanet. Am i right or book already…
senzacionale
  • 20,448
  • 67
  • 204
  • 316
14
votes
3 answers

Fluent Nhiberhate And Missing Milliseconds

I am using Fluent Nhibernate and Nhibernate for my current project. I need to record the time to the millisecond. I have this for my mapping Map(x => x.SystemDateTime) .CustomType("Timestamp") …
14
votes
1 answer

Prevent Nhibernate schemaexport from generating foreign key constraints on has many relationship

I have a mapping like this: HasMany(x => x.Orders).KeyColumn("CustomerID"); Which is causing a constraint like this to be generated by schemaexport: alter table [CustomerOrder] add constraint FK45B3FB85AF01218D foreign key (CustomerID) …