fluent-nhibernate

NHibernate2 query is wired when fetch the collection from the proxy. Is this correct behavior?

This is my class: public class User { public virtual int Id { get; set; } public virtual string Name { get; set; } public virtual IList<UserFriend> Friends { get; protected set; } } public class UserFriend { public virtual int Id { get; set; } public virtual User User { get; set; } public virtual User F...

How do you filter one to many relationships with fluent-NHibernate?

I have a set of entities where they could possibly be set as deleted using an "IsDeleted" flag in the database. This is fine for the normal set of entities, however when I have a parent with many child entities that may have this flag I would like NHibernate to be able to automatically handle selecting the child entities that have "IsD...

Possible Bug in Fluent-NHibernate Repository?

I think I might have found a bug, but I'm not really sure. It could be a syntax error on my part, but the compiler isn't catching. Anyway, here is what I'm trying to do. Basically I've written my own repository class that essentially just wraps the Fluent Repository class. So here is the relevant code: Public Class GenericRepositor...

Full Linq Query Instead of Lambdas with Fluent-NHibernate?

I'm trying to use Fluent-NHibernate's Query method which looks like this: public T[] Query<T>(Expression<System.Func<T, bool>> where) { return _session.Linq<T>().Where(where).ToArray(); } I'm using VB, so to send it a lambda expression I can call it with a line like this: Dim products = flRepos.Query(Of Pr...

Fluent NHibernate API and .NET 2.0

Can I use Fluent NHibernate API for .NET 2.0 applications. ...

Read Mapping Xml file generated by FluentNHibernate API

How can I read mapping Xml file generated by Fluent NHibernate API? ...

Cascade.SaveOrUpdate (SQLite) fluent-nhibernate

Hi, I have a many-to-many relationship between two classes: Tournament and Players I set Cascade.SaveUpdate in the mappings, but when saving a Tournament instance, the Players will not be saved to the Players table. Nhibernate only writes parent and child key columns in the linking table. The DB is SQLite. These are the mappings pub...

Fluent NHibernate question

Let's say you have two tables, "Users" and "UserRoles". Here's how the two tables are structured (table - columns): Users - UserID (int) UserRoles - UserID (int), Role (string) What I want is for my "User" class in my domain to have an IList of roles. How do I construct my Fluent NHibernate mapping to achieve this? ...

Rhino.Commons + Fluent NHibernate

Hello, Is there a way to use Rhino.Commons with Fluent Nhibernate, (in particular AutoMapping)? Many thanks fromano ...

How do you map an enum as an int value with fluent NHibernate?

Question says it all really, the default is for it to map as a string but I need it to map as an int. I'm currently using PersistenceModel for setting my conventions if that makes any difference. Thanks in advance. Update Found that getting onto the latest version of the code from the trunk resolved my woes. ...

Mapping Composite keys in Fluent Nhinbernate

Hi, I am new to fluent NHinbernate, now I face one problem with mapping composite keys. Can anyone pointing out the URL or sample please? ...

Is it possible to use private field conventions for Fluent NHibernate Automapping?

How can I map to a private field with fluent NHibernate AutoPersistenceModel? public class A { private List<B> myField; public A() { myField = new List<B>(); } public IList<B> MyBs { get { return myField; } } } Is there a fieldconvention for...

Cascade delete from collections in multiple entities

I have three entities: Customer, Device and LocationTag. Customers have a list of LocationTags (nothing more than an ID and a Description). They also have a list of Devices. Devices are tagged with a subset of the Customer's LocationTags, so Devices have a List of LocationTags, too (but only of the Customer's). If I delete a Locat...

How to create composite UNIQUE constraint in FluentNHibernate?

I know that I can Map(x => x.GroupName).WithUniqueConstraint() for a single property. But how do create a composite unique constraint in fluent nHibernate (where the unique constraint operates on the combination of two columns)? ...

NHibernate: can't successfully set lazy loading

I have a table Parent and a table Child. Child contains a foreign-key to the Parent table, creating a one-to-many relationship. Here is a part of my mapping that I define with fluent NHibernate: public class ParentMap : ClassMap<Parent> { public ParentMap() { WithTable("Parents"); Id(x => x.Id, "ParentID") ...

How do I create a NHibernate Mapping file for a multi-value component that is a Unique set of columns?

I'm using Nhibernate and fluent nhibernate to create a mapping file for a domain object (though I don't care if an answer uses fluent nhibernate or xml hbm syntax). And I'm having trouble with figuring out how I specify that a set of columns representing a component within the domain object is unique. Here's the domain object: public ...

DB Column named "Order" with Fluent NHibernate

I discovered that one of the tables of a legacy db I'm working on has a colum named "Order". Unfortunately I cannot change the DB structure. My Fluent NHibernate class looks like public class SiteMap : AutoMap<Site> { public SiteMap() { WithTable("Sites"); Id(x => x.ID, "Id") .WithUnsavedValue(0) ...

NHibernate not evicting objects from a session.

I'm mapping a ProductCategory tree using Fluent NHibernate and everything was going fine until I tried to walk the tree that is returned from the database to ensure it's saving and retreiving appropriately. Here's how I'm testing: Instantiate 4 categories: Beverages, Beer, Light Beer, and Dark Beer Add Beer to Beverages, then Light Be...

Fluent Nhibernate & Linq (Property Not Found)

Hi, I'm trying to get a web app working based on the S#arp Architecture. At the moment I have a the below code for my entity. [Serializable] public abstract class EventBase : Entity { #region Properties [DomainSignature] public virtual string Name { get; set; } public virtual string Description { get; set; } publ...

How do you map a component that is also a primary key in NHibernate hbm xml (or in a fluent-nhibernate class map)?

I'm trying to figure out how to map a component as a primary key in nhibernate and if possible in fluent nhibernate as well. The component in question is a unique set of 3d coordinates, here's the object: public class SpaceLocation { public virtual SpaceCoordinate Coordinates { get; set; } public virtual SpaceObject AtLocation...