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

Is it possible to set the foreign key of a reference directly in NHibernate?

Got a project that collects data as XML files from a particular system (these come in as web requests), converts it to an entity model, and stuffs it in a database for reporting. The project uses the following software (relevant to this…
Rune Jacobsen
  • 9,907
  • 11
  • 58
  • 75
2
votes
1 answer

nHibernate Euro symbol € change for character ¿

I've tried save a Euro Symbol € using NHibernate and FluentNHibernate in a database Oracle 11g. I have checked a log from NHibernate and see the generated sql statement: UPDATE CURRENCY SET DESCRIPTION = 'Euro', SYMBOL = '€', WHERE ID =…
2
votes
1 answer

NHibernate: can't successfully set lazy loading

I have a table Parent and a table Child. Child contains a foreign-key to the Parent table, creating a one-to-many relationship. Here is a part of my mapping that I define with fluent NHibernate: public class ParentMap : ClassMap { public…
Nicolas Cadilhac
  • 4,680
  • 5
  • 41
  • 62
2
votes
1 answer

Fluent NHibernate generating additional join and creating duplicate entities in bi-directional relationship

a Venue can have one or more Areas and, inversely, each Area has exactly one Venue. I'm using build 1.0.0.636 of Fluent NHibernate. When I added Fetch.Join() to the VenueMap to eliminate lazy loading, the SQL generated includes a join back to the…
Monty
  • 119
  • 2
  • 9
2
votes
1 answer

Nhibernate generates an error in db create script

I'm trying to generate db schema using fluent nhibernate, nhibernate 3.0, spring.net 1.3.1 and SQLite. The create/update script generated by NHibernate is create table LogEntries (Id UNIQUEIDENTIFIER not null, Hostname TEXT not null, LoggerName TEXT…
Thomas
  • 45
  • 6
2
votes
1 answer

Fluent NHibernate dynamic DTO query

I'm trying to write a dynamic query using Fluent NHibernate and struggling to work out how to apply the dynamic where criteria. This is for an ASP.NET MVC5 project, where I wish to display a table of DTOs in a view, with the ability for the user to…
Chris Pickford
  • 8,642
  • 5
  • 42
  • 73
2
votes
1 answer

Fluent NHibernate: Eager load multiple collections in mapping

Given I have the following entity with multiple collection properties... public class Parent { public virtual int Id { get; set;} public virtual ICollection FirstChildren { get; set; } public virtual…
TomJerrum
  • 584
  • 1
  • 5
  • 20
2
votes
2 answers

NHibernate StructureMap ASP.NET webform System.OutOfMemoryException

i created a web application by using Asp.NET webform, NHibernate to access Sql Server 2008 database and StructureMap as IOC Container. Everything seem to work ok since few users use it; when user number increases (we can say 10+ users) webapp…
frabiacca
  • 1,402
  • 2
  • 16
  • 32
2
votes
1 answer

SelectList in QueryOver

I have some problem with selecting by QueryOver, here are my model classes: public class BaseModel { public virtual int Id { get; set; } public virtual DateTime ModifyDate { get; set; } public virtual DateTime CreateDate { get; set; } …
DamianM
  • 468
  • 1
  • 6
  • 15
2
votes
0 answers

Is there a way to use a Join mapping in fluent nhibernate with a filter specified?

I have a scenario where I want to create map a class that pulls data from two table together. For example, my two tables are Persons and PersonAddresses. I want the resulting mapped class to merge these two together like this: public class…
Jason
  • 2,701
  • 2
  • 25
  • 35
2
votes
1 answer

Fluent NHibernate mappings for localization

I am trying to build a Database from NHibernate mappings and have run into a problem. I have many classes with localized string values: public class MyClass1 { public virtual int Id { get; set; } public virtual ShortString Name { get; set;…
Johan Öbrink
  • 1,241
  • 1
  • 11
  • 17
2
votes
1 answer

Fluent NHibernate - HasManyToMany with multiple ChildKeyColumns possible?

I have got two kind of entities, comments and tasks. Both types can be bookmarked by a user. So I have created a table called 'Bookmarks': CREATE TABLE [dbo].[Bookmarks] ( [ID] [int] IDENTITY(1,1) NOT NULL, [FKUserID] [int] NOT NULL, [FKCommentID]…
asp_net
  • 3,567
  • 3
  • 31
  • 58
2
votes
5 answers

Map One-To-One Relationship Doesn't Allow Inserting

I'm trying to setup a one-to-one mapping from my Users to the UserDetails table. Say I have the following tables in my database: Users: - UserID (PK, Identity) - UserName - Password UsersDetails: - UserID (PK, FK) - FirstName - LastName I have…
nfplee
  • 7,643
  • 12
  • 63
  • 124
2
votes
2 answers

How can I trim string property datatypes from database char datatypes in Fluent NHibernate

I have a SQL database and a Oracle database with the same schema. Therefore I want to use my model classes for the two databases and all I will do is change the database connection string in the Fluent NHibernate configuration. I have some database…
Jon
  • 38,814
  • 81
  • 233
  • 382
2
votes
2 answers

Why does Fluent NHibernate create ALWAYS a Text field from a C# String property as DEFAULT?

I run this sample here: https://github.com/jagregory/fluent-nhibernate/blob/master/src/Examples.FirstProject/Program.cs All C# Properties of type String are mapped into TEXT sql fields and not nvarchar OR varchar as I would except it to be as…
Elisabeth
  • 20,496
  • 52
  • 200
  • 321