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
0 answers

Fluent NHibernate - ¿How can i map 3 parent tables to the same child table?

I have 3 parent tables pointing to the same child table. I need to write the mapping. I've tried with "HasManyToMany" but i only achieved inserted two fields into the child table instead of the 3 fields. HasManyToMany(x =>…
0
votes
1 answer

Map Postgis Point to Point in C# using Fluent NHibernate

I am working on Mapping Spatial geometry(Point) On Postgresql to C# Code I need something like example in this question like example in this question but using Postgresql Instead of SQL Server I did the following public class Student { public…
0
votes
1 answer

NHibernate Fluent Add external Assembly mappings

I have a project with my mappings and entities stored in other class libraries and NHibernate layers in another project. In my testing project I would like to add these mapping via fluently configure... Mappings... via assebly and not individually. …
0
votes
2 answers

not-null property references a null or transient value - understanding of Inverse and Cascade

This is fragment of my database project, and this is fragment of auto generated DB by Fluent NHibernate And these are my entities and mapping classes in Fluent NHibernate of above DB project. Entities: public class BaseEntity where T :…
0
votes
1 answer

Fluent NHibernate error: Must have same number of columns as the referenced primary key

I am new with Fluent NHibernate and I have a problem with a particular HasMany relationship. I have three objects: User, Company and CompanyAddress User references Company correctly and Company would reference CompanyAddress (but this…
0
votes
1 answer

Fluent NHibernate Many-to-Many Mapping Self Referencing with associative table

Just for record : I use C#, Fluent NHibernate, and MySQL 5. I used to use NHibernate for this project, but recently I decided to use Fluent NHibernate instead. And I got problem in mapping the many to many relationship that references to self with…
0
votes
2 answers

NHibernate mapping from dtd or xsd or even xml document itself

I have searched and searched but couldn't find anything even remotely resembling an answer. I have a DTD (xml-dtd) for an XML document type (my document type, nothing NHibernate-related) and I would like to store all documents of that given document…
0
votes
1 answer

Change NHibernate Model Mapping at runtime

I'm retrieving an entity with an Guid Identifier from a database ... and I need to save entity to another database and keep the same Guid Identifier.Right now, NHibernate is generating a new Guid every time I perform a save operation, and this is…
0
votes
2 answers

Self referencing entity in NHibernate gives object references an unsaved transient instance exception

I have a self referencing entity named Category. A category may have one or more child categories. A category may also have no childs. I have made the entity and mapping but I keep getting this exception. NHibernate.TransientObjectException :…
0
votes
1 answer

Fluent NHibernate "Database was not configured through Database method."

i'm starting with Fluent.NHibernate for my C# web probject that already uses NHibernate correctly and now i want to migrate to Fluent. When i try to doing a config request i receive the error: An invalid or incomplete configuration was used while…
0
votes
1 answer

C# Fluent NHibernate queryover how to query records from Link table in many to many relation

I am new to Fluent NHibernate. I have the following mappings for many to many relation. How to write a query using queryover so that bring back records if the product doesn't exist in product table but available in ProductLink table? For some…
0
votes
1 answer

Nhibernate Many to Many Soft Delete

I'm looking for a way to stop items from being removed from the many to many table. I found a post stating I could make use of IPostCollectionRemoveEventListener and/or IPostCollectionRecreateEventListener. Problem is that neither of them are being…
Beejee
  • 1,836
  • 2
  • 17
  • 31
0
votes
1 answer

NHibernate doesn't return auto-generated value after insert

I have the following entity public class Entity{ public virtual int Id { get; set; } public virtual DateTime CreatedDateTime { get; protected set; } } and I have the following nhibernate fluent mapping public class EntityMap :…
kord
  • 979
  • 14
  • 24
0
votes
1 answer

Object referenced by many, without own property

I have a class that is referenced by many other classes: class Foo { // Some properties } class Bar { public Foo Foo { get; set; } } I can map this relationship on the Bar end: class BarMap : ClassMap { public BarMap() { …
maddisoj
  • 576
  • 6
  • 16
0
votes
1 answer

FluentNHibernate Many-To-Many Conditional Count on Child

Consider the following entities: Package Manifest Content ---------- ---------- ---------- Id PackageId Id Name ContentId Name Status The relationship is…
Charles Chen
  • 1,395
  • 13
  • 22