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

NHibernate LINQ and Many to Many Mapping

I have this clases mapped on NHibernate 3.2 with FluentNHibernate 1.3: public class ClassA { public virtual Int32 Id{ get; } .... public ICollection ClassesB { get; } public ICollection ClassesC { get; } } public…
0
votes
1 answer

Fluent NHibernate Many-To-Many Mapping with 3 classes

First, I'm using NHibernate 3.2 and FluentNHibernate 1.3. I have 3 clasess: public class ClassA { public virtual Int32 Id{ get; } .... public ICollection ClassesB { get; } public ICollection ClassesC { get;…
0
votes
1 answer

parent->child relation to parent->group->child

i have a legacy database (which is still used by another legacy application) where the group is denormalized and duplicated into the child rows table parent ( id ) table child ( id parent_id group_id group_name group_Flag group_type …
0
votes
1 answer

QueryOver fetches all implementations

Nhibernate has a nice feature, which I have discovered coincidentally: public interface IInterface {} public class Impl1 : IInterface {} public class Impl2 : IInterface {} ISession session =…
0
votes
2 answers

Nhibernate Best way to mapping Parent > Child

I'm new in NHibernate and I have some doubts. I'll put my code bellow and then I'll explain. My tables: My classes: public class IntegratorModel : PGIBaseModel, IIntegratorModel { public virtual string Identifier { get; set; } public…
japoneizo
  • 508
  • 1
  • 5
  • 15
0
votes
1 answer

How to limit Entites to particular Database in Multiple Database FluentNhibernate Application

I'm done configuring the Fluent NHibernate application using multiple databases. When I run the application, I see that the session is creating the same tables in all the databases. I tried limiting the creation by using the following line of code…
navule
  • 3,212
  • 2
  • 36
  • 54
0
votes
1 answer

How to turn off cascade deleting?

I have class with back reference: public class Employee : Entity { private string _Name; private string _Position; private Employee _SupervisorBackRef; private IList _Subordinates; private…
0
votes
1 answer

Fluent Nhinernate mapping for hierarchical/ tree structure table

I have a hierarchical (tree structure) SQL Server table TEmployee with following columns Id bigint identity(1,1) not null FirstName nvarhcar(50) not null LastName nvarchar(50) not null ManagerId bignint null Column Id is primary key. Each employee…
0
votes
2 answers

Mapping two classes to the same table in different environments

Let's say I have this Table: Users ID PK NAME IS_REAL And I have this class for my front-end program (On the internet) Class User { Int ID {get;set;} string Name {get;set;} } And I also want to have another class for my back-end program…
Amir
  • 589
  • 1
  • 5
  • 18
0
votes
1 answer

Mapping products and shopping cart - NHibernate

I was trying my hands on NHibernate and Fluent NHiberate. I wrote two classes as follows: public class Product { public virtual int Id { get; set; } public virtual string Name { get; set; } public virtual decimal Price { get; set;…
TheVillageIdiot
  • 40,053
  • 20
  • 133
  • 188
0
votes
1 answer

FluentNHibernate - How to map without any Identity field

I am using FluentNHibernate. Can anybody plz tell me how to retrieve value from database where no fields is Unique. There is not Identity column to map.
0
votes
1 answer

How to load only the ids for an associated entities

I have N-Tier architecture and in service layer I need a way to get only the ids for associated entities or the full entities. So on one session I only need the ids and in other session I may need the full entities. I have two entities: public class…
0
votes
1 answer

NHibernate: incorrect mapping in Fluent that cause duplicates in result when retrieve all query completed

In brief: query to "parents" table results "parents" + records from "children". "children" have FKs to "parents" and therefore I have as so many duplictes as quantity of FKs in "children". I'm using Fluent.NHibernate in ASP.NET MVC3 project. So, DB…
0
votes
1 answer

Fluent Nhibernate One To One mapping issue

I have to tables, table Person and Profile. Profile has the PK of Person as FK. I also have two classes: public class Person { public int Id { get;set; } public Profile Profile { get;set; } } public class Profile { Public…
Djaved
  • 3
  • 3
0
votes
1 answer

How can i delete the content of the table using fluentnhibernate?

I am using fluent nHibernate for my mappings as follow: public class ContentTagMap: ClassMap { public EmployeeMap() { Id(t => t.Id); Map(t => t.Name); HasManyToMany(t => t.Company); } } public class…
1 2 3
41
42