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
0
votes
1 answer

FluentNHibernate - overriding already existing automappings

I'm trying hard to find a solution to be able to override the automapping of my entity. The flow of execution is that AutoMapping (using conventions) occurs first and then mapping overrides are executed. My entity "Signature" is already mapped by…
kubal5003
  • 7,186
  • 8
  • 52
  • 90
0
votes
1 answer

Fluent NHibernate automapping child class when base already exists in database

I am having difficulty automapping my object using Fluent NHibernate. I have class called Document for which the table already exist in SqlServer. Class Packet extends Document and Have a member PacketDefinition. PacketDefinition has a List of Form…
Mayank
  • 8,777
  • 4
  • 35
  • 60
0
votes
1 answer

NHibernate - Is it possible to map columns into collection composite objects

Using NHibernate is it possible to map columns in a table to a collection of objects. For example if I have a very badly designed database table with columns as…
0
votes
0 answers

How do I use a convention to specify the Foreign Key and the Primary Key should be the same column on a Joined Subclass table?

Title pretty much says it all. If I have 2 classes: public class Account { public virtual Guid AccountId { get; set; } public virtual string Name { get; set; } } public class VendorAccount : Account { public virtual string TaxId { get;…
Jeremy Holovacs
  • 22,480
  • 33
  • 117
  • 254
0
votes
1 answer

Fluent NHibernate - mapping one-to-many relationship to different class/entity hierarchy

I have standard one-to-many table setup, but I want to be able to map it to a class structure that looks like this: Class 1 -> Mapped to Table 1 (The one- side of the one-to-many relationship) | --- Intermediary class that has additional…
Justin
  • 564
  • 4
  • 13
0
votes
1 answer

Displaying nhiberbate components in asp.net

I'm working on an ASP.NET/C#/fluent nHibernate project and have recently discovered the Component mapping feature that I would like to implement. I believe I have my class definitions and mapping file correct, but I am having difficulty retrieving…
Brett
  • 1,267
  • 1
  • 13
  • 21
0
votes
1 answer

How to tell FNH to map snake-case db columns to Pascal case properties?

We have convention to turn snake-case db columns to pascal case in our entities: Map(x => x.ProjectName).Column("project_name"); The mapping is always exactly this. How can we tell FNH to do the work rather than typing them all?
Daniel Williams
  • 8,912
  • 15
  • 68
  • 107
0
votes
1 answer

Fluent NHibernate mapping dictionary wrapper class

I'm trying to migrate an existing HMB mapping file to Fluent mapping but have come unstuck mapping the following classed (simplified). public interface IThing { int Id { get; } string Name { get; } ISettings Settings { get; } } public…
batwad
  • 3,588
  • 1
  • 24
  • 38
0
votes
1 answer

Mapping an abstract base class property to multiple tables (one for each derived class)

I'm using fluent nhibernate, and I'm trying to map a property in my abstract base class, that can't exist on it's own, to a certain table that depends on what the derived class is. public class UnmappedClass : Entity { // This class isn't…
0
votes
1 answer

Map list of items

I have a table called openTickets. I have another table called openTicketFollowers that relates to it using a foreign key. OpenTickets does not know about openTicketFollowers but I want openTickets to have a property that is a list of its followers.…
0
votes
1 answer

Fluent nhibernate mapping

In my class i have a boolean property: public virtual bool IsDefaultPrice { get; set; } I want to set the value of that property in my mapping based on the values of some columns in my db table. in my table i have two…
Djave
  • 277
  • 1
  • 5
  • 14
0
votes
1 answer

Fluent NHibernate map entity so that it can only perform updates and selects

Im on a legacy system where triggers are abundant in the database. Therefore I have an entity mapped in Fluent NHB on which I would like to enforce that only updates and selects can be performed, as there is a trigger on another table which performs…
0
votes
1 answer

Fluent nhibernate map lookup table as enum

I am trying to map a lookup table to an enum using: FluentNhibernate 1.3.0.733 NHibernate 3.3.1.4000 I am not able to load objects. If I remove the enum mapping I can load objects. Code: Order order = session.Get(id); Error: Provided id of…
Cogslave
  • 2,513
  • 3
  • 25
  • 35
0
votes
1 answer

Problems with updating records through Many-To-Many mappings

I have a problem where I have a many-to-many mappings in my table structure creating headaches when trying to edit a simple record. Example layout of where I am having problems: Facilities Many-to-One Locations Facilities One-to-Many Users Users…
0
votes
1 answer

Mapping Fluent NHibernate component with one-to-many relationships insede it

I have these classes: class A { public virtual Guid Id { get;set; } public virtual B Data { get; set; } } class B { public IList InnerData1 { get; set; } // (1) public IList InnerData2 { get; set; } // (2) } class C { …
bodziec
  • 574
  • 1
  • 6
  • 23