Questions tagged [fluent-nhibernate-mapping]

Fluent, XML-less, compile safe, automated, convention-based mappings for NHibernate

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.

Resources

626 questions
32
votes
3 answers

Difference between FluentNHibernate and NHibernate's "Mapping by Code"

I am coming from an Entity Framework and LLBL background for my ORM tools. I have been asked to build a new system based on NHibernate. I have never done so, so I am coming at it with fresh eyes. What is the difference between mapping with Fluent…
20
votes
3 answers

Fluent NHibernate to query stored procedure without an hbm.xml mapping

Is there any way to query stored procedure in Fluent Nhibernate without creating an hbm.xml file mapping?
rahul
  • 184,426
  • 49
  • 232
  • 263
18
votes
2 answers

Fluent Nhibernate Many to Many Mapping Way

I have two classes Order and Items I want a method like this class Order { public virtual IList GetItems(Order order) { //get items for that order. } } class Item { public virtual IList GetOrders(Item item) …
Infant Dev
  • 1,659
  • 8
  • 24
  • 48
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") …
12
votes
2 answers

Mapping private attributes of domain entities with Dapper dot net

In most of my projects I use nHibernate + Fluent mapping and recently I've started to play around with Dapper to see if I can move read operations to it. I follow DDD approach so my domain entities do not have any public setters. For…
12
votes
1 answer

Fluent Nhibernate Mapping for Sql Views

i am using Fluent Nhibernate in asp.net mvc3 with c# i am working in following way to generate and map a class Mapping using FluentNHibernate.Mapping; using Com.Web.Domain; namespace Com.Web.Mapping { public class CompanyMap :…
11
votes
1 answer

Fluent nHibernate: Unsupported mapping type

I'm setting up a new solution to map against SQL data that has been imported from an Access database. Auto Mappings work fine against the entities I have defined but I need to be able to use the Fluent mapping type to give access to the…
11
votes
1 answer

Fluent NHibernate generates extra columns

We are using Fluent NHibernate for data object model in the company i work. A couple of days ago, we encountered an issue that Fluent NHibernate generates an extra column which does exist neither in model nor in mapping. Here is the situation: My…
10
votes
3 answers

Fluent NHibernate One-To-Many Mapping

I have the following 2 classes: Advert public virtual int Id { get; set; public virtual IList AdvertImages { get; set; } AdvertImage public virtual int Id { get; set; } public virtual string Filename { get; set; public virtual Advert…
9
votes
3 answers

Fluent NHibernate HasMany Foreign Key Mapping Problem

I'm trying to map a simple data structure in nhibernate Tables: Employees employeeID int username varchar(30) departmentID int Departments departmentID int deptName varchar(50) My department mapping is like so: public class DepartmentMap:…
Chris Klepeis
  • 9,783
  • 16
  • 83
  • 149
9
votes
3 answers

Mapping the same entity to different tables

A bit of domain knowledge I'm writing a POS (Point Of Sales) software which allows to pay goods or to refund them. When paying or refunding, one need to specify which money transfer mean to use: cash, EFT (~=credit card), loyalty card, voucher,…
9
votes
2 answers

Fluent NHibernate - Unnecessary update

In a unidirectional many-to-many relationship between Registration and Item, where a Registration has an ISet ItemsPurchased and Item has no reference back to registrations (it's not a useful way to explore the object graph), when I look at…
9
votes
1 answer

Unrecognized configuration section applicationSettings in NHibernate

I'm using fluent NHibernate. I have an app.config file with few specific keys (applicationSettings and userSettings). It seems that the nhibernate doesn't like these keys. As long as these keys exist in the file, the Fluently.Configure() fails and…
8
votes
1 answer

CompositeId causes Could not compile the mapping document error

I am trying to use CompositeId to map to a legacy system. The source database has a composite primary key so I can't use the normal this.Id mapping. Here is my attempt to map it: public PriorityListPartMap() { this.Schema("EngSchedule"); …
Matthew MacFarland
  • 2,413
  • 3
  • 26
  • 34
8
votes
4 answers

How to add mappings by namespace in Fluent NHibernate

In my application, I need to talk to multiple databases. I am handling this in NHibernate by creating one SessionFactory per database (I assume this is the correct thing to do). So I have two sets of models (one per database), and two sets of Fluent…
1
2 3
41 42