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

FluentNHibernate table column order

I can't seem to make my table's column order right with Fluent NHibernate. Employee.cs public class Employee : Entity { #region Fields private EmployeeStatus _status; private DateTime _created; private DateTime? _updated; …
Samuel Adam
  • 1,327
  • 4
  • 26
  • 45
0
votes
1 answer

Fluent NHibernate mapping test fails with foreign key

I'm learning NHibernate with Fluent. I'm trying to test mappings and one of my tests fails. Here are the entities, mappings and test class: public class Employee { public virtual int Id { get; set; } public virtual string FirstName { get;…
0
votes
1 answer

Not sure how to join tables using Fluent NHibernate

I'm using NHibernate on legacy tables and after looking through our codebase, I seem to be the only person with this need. I need to join two tables so I can run a query, but I haven't made any progress today. I'll try to abbreviate where it makes…
0
votes
1 answer

NHibernate: One object, multiple mapping files

I met a question about NHibernate mapping. Currently I have one object Person below. class Person{ public string FirstName{get; set;} public string LastName{get; set;} public string Age{get; set;} public string Sex{get; set;} public…
0
votes
1 answer

How can I retrieve a Dialect instance in Fluent NHibernate mapping

Consider we have an application that uses Fluent NHibernate to access some data base (we don't know exactly what type of DB will it be). And consider we want to map some class that has an id of unsigned type (for example ulong): public class…
0
votes
1 answer

Complex Entity aggregation

Hi have are very complex design of entities aggregation in project. I'm using domain driven development. To map entites i'm using FluentNHibernate Here is my design of domain public abstract class Domain { public virtual long…
0
votes
1 answer

Fluent NHibernate - Multiple collections in the same table

Im working on rebuilding a clients software and they want to keep their database as unmodified as possible. I got a table where they collect users and orders for different companies, no biggie there but the twist is they do it for multiple…
0
votes
1 answer

Doesn't update many to many attribute using NHibernate

Suppose I have only two classes: Group and User. User has groups and Group has members (instance of users) public class User { public virtual int id { set; get; } public virtual string username { set; get; } public virtual IList
0
votes
1 answer

Different mapping for the same database. NHibernate

I'm using Fluent NHibernate. I have a few applications that use the same database (mainly the application itself, and configuration and reporting tools for it, that are separate .exe) They share the same mapping now, defined fluently in common .dll.…
Archeg
  • 8,364
  • 7
  • 43
  • 90
0
votes
1 answer

Need help to write query that uses max and group by by using nhibernate queryover

I am new to nhibernate and i fail to find out how to do this sql query by using queryover api: SELECT category, MAX(number) as "Highest number" FROM table1 GROUP BY category; any help would be appreciated
0
votes
1 answer

Nhibernate Save relation of same entities into other table

I have a S table. It can have some Children. The Children are same type(S). Table : S(Id,Name) Table : S_R(Parent_S_Id,Child_S_Id) Classes are public class S { public virtual int Id { get; set; } public virtual string Name { get; set; } …
0
votes
1 answer

FluentNhibernate .CheckReference is failing

public class WorldEntity { public WorldEntity() { Scenes = new List(); } public virtual int Id { get; set; } public virtual string Name { get; set; } public virtual string Picture { get; set; } public…
0
votes
1 answer

FluentNHibernate - Mapping a class to multiple tables

Sorry for a lengthy question. But it is worth giving all the details so please bear with me through to the end. I'm working against a legacy database over which I do not have much control. I want to be able to map a class to multiple database…
0
votes
1 answer

Fluent NHibernate Mapping and Retrieve Hierarchy Table

I have a hierarchy category table like this Id int, Description varchar(100), ParentId int, Ordinal int, IsActive bit I want to fetch all of the Categories from parent to child, so when I called session.get(id), it already fetched all of…
Dion Dirza
  • 2,575
  • 2
  • 17
  • 21
0
votes
1 answer

Fluent Nhibernate --- How to make it NOT update the other table

I have a [User] table/class and a [Company] table/class and there is a link-table [UserCompany] between them. When editing a User, beside basic information people also could change that user's access Companies, so I do the map like this in…
Samuel
  • 631
  • 1
  • 10
  • 26