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

How to query NHibernate for specific type?

I'm using Fluent NHibernate with DiscriminateSubClassesOnColumn() to support subclassing. The column used to discriminate between subclasses is not mapped to an actual property on the entity. How do I create a query which returns only entities of a…
hakksor
  • 1,380
  • 1
  • 9
  • 14
2
votes
2 answers

Configuring Fluent NHibernate from NHibernate config section

I'm trying to use Fluent NHibernate in my solution by configuring it with the following NHibernate xml configuration section
Oz Maqsood
  • 21
  • 1
  • 2
2
votes
1 answer

Fluent Nhibernate mapping inner join on 3 tables

Datastructure is: Table[Questionnaire] the top node Table[QuestionGroup] just a grouping for heading etc Table[QuestionnaireQuestion] mapping [Question]<->[QuestionGroup]s many to many relationship and the [Questionnaire]<->[Question]s many to many…
Bernt
  • 249
  • 6
  • 12
2
votes
2 answers

NHibernate returning duplicate rows

NHibernate appears to be returning the contents of the first row multiple times. As many times as there are actual, distinct rows in the database. For example, if one person has 3 campus affiliations like this: Baker College - Teacher Bryant…
Harry Sanborn
  • 116
  • 1
  • 8
2
votes
1 answer

Fluent NHibernate - mapping portions of a single table into multiple classes with a few shared fields

I have a situation where a User table has lots of information about a user (first name, last name, email, etc) in addition to credential data (username, password, prior passwords, etc). Normally I would separate Authentication from Personalization,…
Josh
  • 16,286
  • 25
  • 113
  • 158
2
votes
0 answers

Fluent NHibernate - many-to-many and composite key

In my application I have 3 entities: class User { public List Roles { get; protected set; } } class Role { public List Users { get; protected set; } } internal class UserInRole { public User User { get; protected set; } …
griZZZly8
  • 694
  • 9
  • 24
2
votes
2 answers

How to tell Fluent hibernate what to name a foreign key?

I have something like this public class AppointmentReminder { public virtual int ReminderId { get; private set; } public virtual CalendarAppointment CalendarAppointment { get; set; } } public class CalendarAppointment …
chobo2
  • 83,322
  • 195
  • 530
  • 832
2
votes
1 answer

how to Unit test fluent mappings, with in memory sqlite when you got sequences

My Real db is oracle, and has sequences(not under my control). I wanna test the mappings with in memory sqlite db, I thought about a few options, do a sequence conventions(if possible) that will be active only when I'm on oracle, make the Id Mapping…
Chen Kinnrot
  • 20,609
  • 17
  • 79
  • 141
2
votes
1 answer

Nhibernate eager fetch for children -> grand children

Searching the net for this one for the past 2 hours. Any help is greatly appreciated. The scenario is like this, we have a Questionnaire, witch has Steps, each step has input sets, each input set has questions. A simple…
Calin
  • 6,661
  • 7
  • 49
  • 80
2
votes
0 answers

NHibernate use Firebird own generator

Having own generator in Firebird DB called GEN_PATIENT_ID I would like to leave the generation of ID on the DB side instead of NHibernate and FluentNHibernate. Following this link I am overriding the default Fluent behavior like this: public class…
pandemic
  • 1,135
  • 1
  • 22
  • 39
2
votes
3 answers

Ninject with Fluent NHibernate within the Repository Layer

Due do LinqToSql not being appropriate for Many To Many relationships I am in the process of deciding to move to NHibernate (Fluent NHibernate) unless convinced otherwise... Project Structure: UI (Mvc2 app with Ninject wiring up all services to…
Haroon
  • 3,402
  • 6
  • 43
  • 74
2
votes
1 answer

Fluent Nhibernate Mapping problem

My legacy system uses two Access database, so I've used separate SessionFactory for each database. I can't use "FluentMapping.AddFromAssemblyOf" function to configure the mappings because the mappings are different for each database. On one of the…
ncfuncion
  • 227
  • 1
  • 3
  • 11
2
votes
1 answer

Fluent Nhibernate AutoMapping Inheritance and Ignoring an Abstract Property

I have an inheritance structure that i have succesfully mapped Product (base) PdfProduct (inherits from Product) & OtherProduct(inherits from Product) These are working fine and i have done a simmilar thing before with hmb.xml files. In the previous…
sianabanana
  • 890
  • 1
  • 11
  • 28
2
votes
1 answer

Fluent Nhibernate Mapping With NotFound.Ignore() Disables Lazy Loading and Fetches Data Incorrectly

I have the following two tables (schema simplified): Device Id, IMSI, ... SIM IMSI, PhoneNumber, ... Because a device can use a SIM card that is not in the SIM table I'm using the following fluent nhibernate mappings in Device.Map…
Robert
  • 486
  • 2
  • 15
2
votes
2 answers

How do I create a NHibernate Mapping file for a multi-value component that is a Unique set of columns?

I'm using NHibernate and Fluent NHibernate to create a mapping file for a domain object (though I don't care if an answer uses fluent NHibernate or xml hbm syntax). And I'm having trouble with figuring out how I specify that a set of columns…
Mark Rogers
  • 96,497
  • 18
  • 85
  • 138