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
3
votes
2 answers

Mapping entity oneToMany with fluent nhibernate

The problem appears to be simple however I'm having so much trouble trying to map this entities. I just can't see what am I doing wrong. Can you guys help me? I have the class Cliente: public class Cliente { public Cliente () { } public…
3
votes
1 answer

FluentNhibernate mapping when having two primary keys

I use Fluent Nhibernate for my C# application and I have a very basic question. I would like to know what an NHibernate mapping class should look like when we have multiple primary keys. Here is an example showing how I implement mapping and other…
3
votes
1 answer

Fluent NHibernate Component Mapping issue

I have a SQL Server stored procedure that I'm executing using a query string that returns a table with the following columns (ItemNumber, ItemDescription, UPC, Price, Count) representing the count of stores that an Item has for a given price. So…
3
votes
1 answer

Fluent NHibernate AutoMap CultureInfo

I have an issue where i am AutoMapping an Entity with a CultureInfo property, when i try to build the SessionFactory it throws exception with following error: "An association from the table ExampleClass refers to an unmapped class:…
daanl
  • 44
  • 2
  • 14
3
votes
1 answer

NHibernate Spatial Mapping returns Antrl error

I am using NHibernate 3.3. I have a case where I want to insert a calculated column which is not referenced. My Domain Entity can be reduced to the form public class Location { public virtual IPoint GeoLocation {get;set;} } …
frictionlesspulley
  • 11,070
  • 14
  • 66
  • 115
3
votes
1 answer

Limit collection to retrieve only recent entries for readonly entity

The User entity can have thousands of UserOperations. Sometimes I don't want to retrieve (for readonly entity) all of them but only "the recent 10 OR not completed". public class SimpleForm { public class User : EntityBase { // …
Vlad
  • 3,001
  • 1
  • 22
  • 52
3
votes
3 answers

Why is nhibernate complaing about deleting this object?

I have a few objects. Project Object - this represents a basic project ProjectDependency Object - this is mapping object that maps one project to another project (the dependent project). See the nhibernate relationships: here is the…
leora
  • 188,729
  • 360
  • 878
  • 1,366
3
votes
1 answer

Mapping Property to different table Fluent NHibernate

I have two tables which are below. These are just examples my table1 in real life is much larger. What I am aiming to do is lazy load the Notes proerty on the Table1 Entity. I have tried the HasOne mapping but this does not work. Which fluent…
Jake Rote
  • 2,177
  • 3
  • 16
  • 41
3
votes
3 answers

FluentNhibernate + private set

I'm using auto property with private set, and fluentNhibernate throw an error for me... FluentNHibernate.Cfg.FluentConfigurationException: An invalid or incomplete configuration was used while creating a SessionFactory. Check PotentialReasons…
3
votes
3 answers

Fluent NHibernate - Override table names from mapping

I'm using Fluent NHibernate to map my NHibernate models. Now i came accros the problem, that I want to prefix all my tables with an underscore in some cases. So i can't just change the Table(...) definition in my mapping, I have to do it from the…
3
votes
1 answer

NHibernate Many to Many mapping Invalid Column arbitrary [table]_[id]

Ok. I have read a lot of similar situations but all of them seems to be more related to one-to-many mappings. long story short... Here is the code. public class Roles { public virtual int RoleID { get; protected set; } public…
3
votes
1 answer

Fluent NHibernate two levels Inheritance Issue

I want to have Table per Type in one level and one Table for hierarchy in another level. Is it possible? description is here -> I have these classes: public class BaseItem { public int Id{ get; set; } } public class Item : BaseItem { } public…
3
votes
1 answer

Sharing field as composite key and foreign key in Fluent NHibernate

Consider following mapping code please : public sealed class BankMapping : ClassMap { public BankMapping() { CompositeId() .KeyProperty(x => x.SerialNumber, "SerialBankRef") .KeyProperty(x =>…
S.Samani
  • 33
  • 1
  • 5
3
votes
1 answer

Fluent NHibernate - Is it possible to map a property to a persisted computed column in Sql Server

I want to map a readonly property to a computed column in Sql Server using Fluent NHibernate. The property is the substring of another one. I do this to make the substring indexable and have better search performance. But when I use the Formula…
3
votes
2 answers

Trying to map entity with type like it has as a member

I am new to nHibernate, here is my code public abstract class DEField : EntityWithSerializableId { public virtual Boolean IsVisibilityDepended { get; set; } public virtual DEField VisibilityField { get; set; } public virtual String…