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

Specifying the name of a foreign key column

public class TransactionIdentityModelMapping : ClassMap { public TransactionIdentityModelMapping() { Table("TransactionIdentities"); Id(x => x.Id); References(x => x.Transaction); …
weston
  • 54,145
  • 21
  • 145
  • 203
2
votes
1 answer

FluentNHibernate not deleting child entity even with AllDeleteOrphan

I have a Car entity which possesses doors. When the car is deleted, the doors should be deleted too because they don't make sense on their own. Here's the mapping in FluentNHibernate. public class CarMap : ClassMap { public CarMap() { …
2
votes
1 answer

FluentNHibernate Mapping with same primary key

i have 2 tables like this: TABLE ARTICLE Id int NOT_NULL PK Title nvarchar(50) NOT_NULL TABLE CONTENT Id int NOT_NULL PK content nvarchar(MAX) NOT_NULL remarks nvarchar(200) so each article will have a content with pk id same as article pk id,…
Dion Dirza
  • 2,575
  • 2
  • 17
  • 21
2
votes
0 answers

Wrong column type - Found varchar2, Expected NVARCHAR2(255)

i have a mapping configuration for a composite-key using fluent nhibernate and i need some help, because it is not working. I have one class called Agencia that have a composite key for two Int16 collumns that are mapped as number on a oracle 11g…
2
votes
2 answers

Creating Database class Library using NHibernate

I am writing an Class Library as DataModel. DataModel capable of handling all the Database related task. I am using NHibernate and Fluent NHibernate for the same. Now the question arises are as follows : Should we expose the Entity (POCO…
2
votes
1 answer

SubClass Mapping in NHibernate by using same table

I have one table. That is s. There are two classes 1. S and 2. P Plate is inherited from S. The classes are: public class S { public virtual decimal Id { get; set; } public virtual IList

ChildPs { get; set; } } public class P :…

2
votes
1 answer

Fluent NHibernate: Issue with many-to-many relationship with custom intermediary table

(see bottom for updates) So, I have two objects (we'll call them ClassA and ClassB) that exhibit a many-to-many relationship (ClassA can have multiple ClassB objects and vice versa). Rather than a traditional many-to-many, though, the actual…
2
votes
1 answer

Fluent NHibernate Composite Mapping

I am trying to map two tables : the first one has an id (idA) and a field with the id (idB) of the other table. the other one has a composite key based on the previous id (idB) and an other one (idB2) The idea is that the second table contains…
2
votes
2 answers

Error dehydrating property value with fluent Nhibernate with bit

I have this class: public class Person { public virtual long ID { get; set; } public virtual string FirstName { get; set; } public virtual string LastName { get; set; } public virtual boolean IsValid {…
olidev
  • 20,058
  • 51
  • 133
  • 197
2
votes
1 answer

Unidirectional one-to-many NHibernate mapping failing when using FluentNHibernate PersistenceSpecification

I have a domain model where a Order has many LineItems. When I create a new Order (with new LineItems) and use PersistenceSpecification to test the mapping, NHibernate throws a PropertyValueException: var order = new Order() { LineItems = new…
2
votes
1 answer

Fluent NHibernate - Error dehydrating property value; given key was not present in the dictionary

I have a class called ProjectTaskBudget that has a property of type IBudgetableIncomeStream, like so: public class ProjectTaskBudget { public virtual IBudgetableIncomeStream BudgetableIncomeStream { get; set; } } IBudgetableIncomeStream is an…
Colm Prunty
  • 1,595
  • 1
  • 11
  • 29
2
votes
2 answers

Fluent NHibernate Mapping Reference

I am fairly new to Fluent NHibernate. I was wondering if someone would please guide me into the right direction. I have a class WorkDay, which represents every day of the week. Table("WorkDays"); Id(x => x.ID).GeneratedBy.Identity(); Map(x =>…
2
votes
0 answers

How do I make this foreign key naming convention?

I am trying to use a Fluent NHibernate naming convention to make my foreign keys follow this naming standard: fk__ ...but using the conventions, I can't seem to get the table names. …
2
votes
1 answer

Fluent NHibernate Reveal not using given propertyname

I am trying to map the following protected collection in my class: public class AddressList { protected readonly IList
addresses = new List
(); } With the following mapping: HasMany
(list =>…
2
votes
1 answer

Disabling caching in Fluent Nhibernate for a specific override

We're using convention based mapping with Fluent NHibernate. The mapping looks like so: .Conventions.Add ( Table.Is(x => string.Concat(x.EntityType.Name.ToLower(), "s")), PrimaryKey.Name.Is(x…
Dion
  • 854
  • 1
  • 11
  • 20