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
25
votes
5 answers

DateTime precision in NHibernate and support for DateTime2 in NHibernate SchemeExport

I am then using Fluent NHibernate and its automapping feature to map the the following simplified POCO class: public class Foo { public virtual int Id { get; set; } public virtual datetime CreatedDateTime { get; set; } } The…
j3ffb
  • 335
  • 1
  • 4
  • 12
24
votes
3 answers

how to set generate_statistics = true with fluent nhibernate

From what I understand I need to end up with this true on the session factory configuration, but I've no idea how to do that with fluent nhibernate.
Andrew Bullock
  • 36,616
  • 34
  • 155
  • 231
24
votes
5 answers

NHibernate - not-null property reference a null or transient value

I'm getting this exception (Full exception at the bottom): NHibernate.PropertyValueException was unhandled by user code Message="not-null property references a null or transient valueClearwave.Models.Encounters.Insurance.Patient" …
23
votes
3 answers

Fluent NHibernate Where Clause

I have to write a query in Fluent NHibernate for Select * from Users where UserName = 'Abcd' AND Password = '123456' How to create above query with session.CreateCriteria
Saad
  • 1,312
  • 5
  • 17
  • 40
23
votes
6 answers

fluent nhibernate HasOne WithForeignKey not working

Whenever I load a Task class, the Document property is always null, despite there being data in the db. Task class: public class Task { public virtual Document Document { get; set; } Task Mapping override for AutoPersistenceModel: public void…
Andrew Bullock
  • 36,616
  • 34
  • 155
  • 231
23
votes
3 answers

Map Enum as Int with Fluent NHibernate and NHibernate 3

I used this How do you map an enum as an int value with fluent NHibernate? to map in the past but I've recently upgraded to NHibernate 3 and this doesn't seem to work anymore. I've put breakpoints in my EnumConvention class and they're not being…
Josh Close
  • 22,935
  • 13
  • 92
  • 140
23
votes
5 answers

Binary Blob truncated to 8000 bytes - SQL Server 2008 / varbinary(max)

I have upgraded from Fluent Nhibernate 1.0 with Nhibernate 2.1 to pre- release 1.x with NHibernate 3.0 GA and have hit what I think is a regression, but I want to hear if that's indeed the case. I am using SQL Server Express 2008 and the MSSQL 2008…
Ivan Zlatev
  • 13,016
  • 9
  • 41
  • 50
23
votes
7 answers

what does this error mean in nhibernate

Out of the blue, i am getting this error when doing a number of updates using nhibernate. Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [MyDomainObject] there is no additional information in the error. …
leora
  • 188,729
  • 360
  • 878
  • 1,366
23
votes
1 answer

NHibernate L2 Cache configuration in Fluent NHibernate

Is ti possible to configure the L2 cache provider in code via FHN? Adding a line to the following config is what I'm after: return Fluently.Configure() .Database(MsSqlConfiguration.MsSql2005.ConnectionString(c =>…
AwkwardCoder
  • 24,893
  • 27
  • 82
  • 152
23
votes
3 answers

LINQ Fluent NHIBERNATE .Contains() does not work in QueryOver<> but works in Query<>

Using FNH, i am trying to retrieve categories, using the following: _session.QueryOver() .Where(c => tourCreateRequest.Categories.Contains(c.CategoryId)) …
jaxxbo
  • 7,314
  • 4
  • 35
  • 48
22
votes
1 answer

NHibernate "Could not determine type for X" error

After upgrading the NHibernate and FluentNHibernate DLLs in a project, I'm now getting a "Could not determine type for: MyApp.Domain.Entities.AppCategory" exception thrown when initializing the SessionFactory. The only change in my code was…
MikeWyatt
  • 7,842
  • 10
  • 50
  • 71
22
votes
5 answers

NHibernate.Spatial and Sql 2008 Geography type - How to configure

I am trying to use Nhibernate with the Sql 2008 Geography type and am having difficulty. I am using Fluent Nhibernate to configure which I am fairly new to so that may be the problem as well. First, the class I am trying to persist looks something…
Luke Foust
  • 2,234
  • 5
  • 29
  • 36
22
votes
4 answers

Fluent NHibernate Many-to-Many

I am using Fluent NHibernate and having some issues getting a many to many relationship setup with one of my classes. It's probably a stupid mistake but I've been stuck for a little bit trying to get it working. Anyways, I have a couple classes that…
Ryan Lanciaux
  • 5,965
  • 2
  • 37
  • 49
21
votes
3 answers

Syntax to define a NHibernate Filter with Fluent Nhibernate?

It seems I can't find the correct syntax to define a nhibernate filter using fluent Nhibernate. I'm trying to follow this ayende's blogpost: http://ayende.com/Blog/archive/2006/12/26/LocalizingNHibernateContextualParameters.aspx I defined the…
Drevak
  • 867
  • 3
  • 12
  • 26
21
votes
5 answers

Cascade Saves with Fluent NHibernate AutoMapping

How do I "turn on" cascading saves using AutoMap Persistence Model with Fluent NHibernate? As in: I Save the Person and the Arm should also be saved. Currently I get "object references an unsaved transient instance - save the transient instance…
rmontgomery429
  • 14,660
  • 17
  • 61
  • 66