fluent-nhibernate

castle nh facility - 2 databases / 2 models / 2 factories

Hi I have asked this on the castle list as i'm using the nh facility but it just dawned on me to ask it here too :) sorry for the cross posting. I'm using the nh facility to configure the following setup: i have 1 database which stores generic report configuration. and another which stores the actual report data. i also have 1 proje...

FluentNHibernate - Setting default value for DB columns (SQL Server)

Hi everyone, does anyone know a way how I could set through mapping the default value of a column so for e.g. when I generate DB from mappings I would have DateTime column having getdate() as default value? I tried so far this (looks exactlly like what I need) but it doesn't work this.Map(x => x.LastPersistedOn, "DateModified") ...

Fluent nHhibernate gets but fails to save with 'HasManyToMany'

I have a Resource entity which has a many-to-many relationship with a File entity, such that a resource can reference multiple files and a file can reference multiple resources. Now I expect the save to cascade down from the Resource to the File entities when the Resource is Saved - When I load a Resource entity it is loading the File e...

NHibernate is turning my collection readonly. How can I stop it?

Hi guys, I'm having a bit of an issue with Nhibernate / Fluent NHibernate I have a class that has a collection and a backing field, and methods for manipulating the collection like so: Edit: I've added the virtual modifier to Children since I forgot to stick it in the example code below (it was 2 am) public class MyClass { private...

Fluent NHibernate: mapping one-to-one

NHibernate seems to support a special case of one to one mapping (That doesn't require a 1-m mapping on each side of the relationship). See this article by Ayende: http://nhforge.org/blogs/nhibernate/archive/2009/04/19/nhibernate-mapping-lt-one-to-one-gt.aspx I have no idea how to specify this in Fluent NHibernate though - is this pos...

Filtering a joined property in NHibernate

I have two tables that are considered a single entity in my domain model. I join them in my IAutoMappingOverride by calling IgnoreProperty on the properties of the joined table and then using Join with a Map for each of the properties. This configuration works, but I'm lost at attempting a filter on the columns of the joined table. I...

Fluent NHibernate: rarely used properties as Component, or in seperate table?

Hi, I wonder if you could help me with something I've been thinking about. Say we have an Entity. Say the endtity has an ExtendedInfo object, which contains various properties which are not often used. I'm wondering how best to structure this for FNH. The easiest thing to do I suppose would just set the UserInfo up as a Fluent Nhibe...

FluentNHibernate RTM and NHibernate.Linq

Hi, I've had a system up and running that used the Fluent NHibernate pre-release v0.0.1.0 along with NHibernate 2.1.0.4000 and NHibernate.Linq 1.0.0.0. I've just put in the new Fluent NHibernate RTM dlls and fixed my code for the breaking changes but I'm getting a couple of issues dependant on how I try to implement. 1) If I don't cha...

Fluent Nhibernate - How to specify table name

Hello, I just started learning Nhibernate and Fluent Nhibernate. I want to specify table name when I create my mapping class. Entity name in application is "CustomerOrders" but in the oracle database, table name is "CUSTOMER_ORDERS". I learnt from googling that I can use "WithTable" to specify database table name. I am not sure ho...

Fluent NHibernate and composite ID with single column name

I've crossed posted this in the FNH Google Group but here's the scoop: I have a table in a legacy database that has a composite ID. Well, the PK is implied since the table doesn't actually have a PK defined, but the natural PK is the combination of the WORKORDERID and IMAGEPATH columns: CREATE TABLE [WORKORDERIMG]( [WORKORDERID]...

Mapping complex classes with Fluent NHibernate

How can I map a class that contains a HashMap using Fluent NHibernate? ...

Does Fluent-Hibernate exist?

Is there something like Fluent-NHibernate for the original Java Hibernate? If not, why not? Are there any language-specific limitations? ...

Mapping custom enum classes with Fluent Nhibernate

Reading some posts from Jimmy Boggard and wondering - how exactly is it possible to map those beasts with fluent nhibernate? How mapping would look like for this?=> public class EmployeeType : Enumeration { public static readonly EmployeeType Manager = new EmployeeType(0, "Manager"); public static readonly EmployeeType...

FluentNHibernate - AutoMappings producing incorrect one-to-many column key

Hi I'm new to NHibernate and FNH and am trying to map these simple classes by using FluentNHibernate AutoMappings feature: public class TVShow : Entity { public virtual string Title { get; set;} public virtual ICollection<Season> Seasons { get; protected set; } public TVShow() { Seasons = new HashedSet<Season>...

Join between two non-key fields

I'm working on putting together a simple POC app using Fluent NHibernate to attempt to show that it can do everything our current hand-rolled data access tool and so much more. One of the fringe cases that my boss is worried about is the ability to access multiple schemas within the same database in one query. So far I have been able to ...

Implementing repositories using NHibernate and Spring.Net

I'm trying to get to grips with NHibernate, Fluent NHibernate and Spring. Following domain-driven design principals, I'm writing a standard tiered web application composed of: a presentation tier (ASP.Net) a business tier, comprising: an application tier (basically a set of methods made visible to UI tier) repository interfaces and d...

What's the most productive way to do NHibernate mapping?

I know annotations to do the hibernate mapping in Java and am looking now for a similar way to do the same in C# and NHibernate. I found out that there exists several approaches do the mapping in xml files NHibernate.Mapping.Attributes (NHMA) Fluent are there any more?? I tried NHMA and found out it had some blocking points for me......

AutoMap.AssemblyOf maps entire namespace

I am a complete beginner with Fluent and I am running into an issue which is probably my own fault. I have a namespace containing 3 classes. Entity, EntityVersion and Property. No inheritance involved between the classes. I try to only map the Entity class but what happens is that all classes in the namespace are being mapped. What am ...

fluent NHibernate one-to-one relationship?

I have a problem with one-to-one relationships in the fluent nHibernate. I have the following relational table from the AdventureWorks2008 database. BusinessEntity (Table) BusinessEntityId Int (PK, Identity) Person (Table) BusinessEntityId int (PK, Reference with BusinessEntity table) FullName varchar(255) The relationship...

PersistenceSpecification and Enums

How does one test enum type properties with PersistenceSpecification. I have it mapped like this Map(x => x.AccountStatus).Column("Status").CustomSqlType("int").Not.Nullable(); and I check it like this spec.CheckProperty(o => o.AccountStatus, UserStatus.Disabled) but it fails with this message NHibernate.HibernateException: ...