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

Fluent NHibernate Problems with SQL Server 2008 DATE Column Values

Greetings, I'm having problems using a SQL Server 2008 DATE column in C# using Fluent NHibernate. When I try to update a record that has a value in a non-nullable DATE column prior to 1/1/1753 (the min date for a DATETIME), I'm getting an error…
Jim Fennell
  • 235
  • 3
  • 8
9
votes
2 answers

what does inverse and cascade means in NHibernate

I'm learning Fluent Nhibernate and my question is: What does Inverse mean? I read that it means that the other side of the relationship is responsible for the saving, and so does Cascade, Can someone please explain what are the differences between…
gdoron
  • 147,333
  • 58
  • 291
  • 367
9
votes
4 answers

Unit testing and nhibernate?

I am wondering how to get around this. I am using nhibernate and fluent. I have a domain class like this public class User { public virtual int UserId {get; private set;} } this seems to be the convention when doing nhibernate as it stops people…
chobo2
  • 83,322
  • 195
  • 530
  • 832
9
votes
1 answer

FluentNHibernate mapping; Unable to map double or decimal with scale/precision

I'm working first time with FluentNHibernate, trying to map classes to SQL Express database. In general it works, but I'm unable to map Double or Decimal property types to specific scale/precision. Below shows result for a single property that I…
bretddog
  • 5,411
  • 11
  • 63
  • 111
9
votes
3 answers

Mapping a List to a delimited string with Fluent NHibernate

My model looks something like this: public class Product { public string Name {get; set;} public string Description {get; set;} public double Price {get; set;} public List Features {get; set;} } I want my database table to…
Alex
  • 37,502
  • 51
  • 204
  • 332
9
votes
9 answers

NHibernate not persisting many-to-many relationship

I'm currently using NHibernate as my data access layer, using Fluent NHibernate to create the mapping files for me. I have two classes, TripItem and TripItemAttributeValue, which have a many-to-many relation between them. The mapping is as…
efdee
  • 2,255
  • 3
  • 20
  • 26
9
votes
1 answer

FluentNHibernate and VARCHAR Columns

I am starting a simple .NET project with FluentNhibernate. I've followed few examples I've found on the Internet and it seems quite easy to grasp. I've realized that if I let FluentNhibernate build my DB schema (Sql Server 2000) it generates…
LeftyX
  • 35,328
  • 21
  • 132
  • 193
9
votes
1 answer

How to test fluent-NHibernate's PersistenceSpecification.VerifyTheMappings with lists and relational objects?

How would you test this scenario? I've just started looking into NHibernate and having my first bash at TDD. So far I've really enjoyed it and have been using fluent-Nhibernate for my mapping of the classes. However I seem to be hitting a dead end…
John_
  • 2,931
  • 3
  • 32
  • 49
9
votes
4 answers

Fluent nHibernate - Map a list of strings

I have a model such as this (simplified) public class Post { public string ID { get; set; } public string Title { get; set; } public string Body { get; set; } public string AuthorName { get; set; } public List
Alex
  • 37,502
  • 51
  • 204
  • 332
9
votes
3 answers

Quoting column names with NHibernate and PostgreSQL

I have started to use NHibernate 3.0 and PostgreSQL for a small project, so far the ride has been a little rough due to the NHibernate site being down and I'm sure this answer is on their website somewhere. I have a database that has these two…
Nathan W
  • 54,475
  • 27
  • 99
  • 146
9
votes
1 answer

NHibernate mapping with a class hierarchy whose base class is abstract and the discriminator is not a string

Here are the domain model classes: public abstract class BaseClass { ... } public class ChildClass : BaseClass { ... } Note that the parent class is abstract and this is what gives me some difficulties when comes the time to map with fluent…
9
votes
1 answer

How to generate hbm.xml file from FluentNHibernate

I'm trying to follow this tutorial but instead of generating the expected hbm.xml files with my mappings in it generates simple .cs class for my entities like for example: public class ProductMap : ClassMap But I already defined those…
Kris van der Mast
  • 16,343
  • 8
  • 39
  • 61
9
votes
1 answer

Mapping large string with Fluent NHibernate

I'm working with an Oracle DB, and I'm trying to map this class: public class Book { public virtual int Id { get; private set; } public virtual string Author { get; set; } public virtual string Title { get; set; } public virtual…
leeran
  • 298
  • 2
  • 12
9
votes
1 answer

How to solve this exception "Could not find a setter for property 'ProductCode' in class ... "

I am getting the following exception: "Could not find a setter for property 'ProductCode'in class ...OrderItem.class " The property (ProductCode) is one of my table keys. see how is the property declaration in the class. public class OrderItem :…
André Luiz
  • 307
  • 5
  • 11
9
votes
3 answers

Fluent NHibernate Map to private/protected Field that has no exposing Property

I have the following Person and Gender classes (I don't really, but the example is simplified to get my point across), using NHibernate (Fluent NHibernate) I want to map the Database Column "GenderId" [INT] value to the protected int _genderId field…
Jon Erickson
  • 112,242
  • 44
  • 136
  • 174