fluent-nhibernate

NHibernate explicit fluent column mapping

I have a set of fluent object mappings that looks like this: public class UserMap : ClassMap<User> { public UserMap() { Map(x => x.Id); Map(x => x.Status); } } public class SpecialUserMap : SubClassMap<SpecialUser> { public SpecialUserMap() { Map(x => x.Property); } } public class Direct...

Reference error with Fluent NHibernate 1.0 RTM and Visual Studio 2010 beta 2

I have a weird reference error when I use Fluent NHibernate 1.0 RTM and Visual Studio 2010 beta 2. Basically I have tried following the getting started tutorial on Fluent NHibernate's page and it doesn't compile. I get those two reference error on Visual Studio : Warning 1 The referenced assembly "FluentNHibernate" could not be re...

Fluent NHibernate one-to-many insert/delete problem

I am trying to add and remove elements from a list mapped as .HasMany(), but nHibernate executes some weird queries on this simple scenario: if (Profile.Artists.Any(x => x.Artist == artist)) { Profile.Artists.Remove(Profile.Artists.Single(x => x.Artist == artist)); } else { Profile.Artists.Add(new Artist { Artist = artist, User =...

NHibernate many-to-many inefficiency?

Hi, I'm trying to setup a sample project using NHibernate and Fluent NHibernate. I am using the example mappings from the Fluent NHibernate web-site. My question is about the many-to-many mapping between Store and Product. It seems (when looking at the generated SQL) that when adding a product to the store, NHibernate deletes all the r...

Cascade options for many-to-one

I am using Fluent NHibernate Automapping and am pretty new to this framework. I have a 'Tab' object which has a single reference to another object 'Caption'. When using Automapping, this relation is generated in the hbm file as a many-to-one relationship with cascade="all" as I have used the Cascade.All() setting for this. Because of t...

NHibernate + Fluent NHibernate + Oracle Index

I have a table with more than 10 000 000 rows. In TOAD this query works very well on it: select /*+ INDEX(x IDX_CASHFLOW_COMPLEX)*/ * from MYPR.CASHFLOW x where fk_debet in (21856, 21854, 21855) IDX_CASHFLOW_COMPLEX is index on 5 columns created by following script: CREATE INDEX MYPR.IDX_CASHFLOW_COMPLEX ON MYPR.CASHFLOW (FK_DEBIT...

Fluent NHibernate: Debugging FluentConfigurationException

I'm enjoying using Fluent NHibernate with AutoMappings but every now and then I get this runtime error when trying to create the fluent configuration: 'An invalid or incomplete configuration was used while creating a SessionFactory. Check PotentialReasons collections, and InnerException for more detail.' Now this can mean all sorts of t...

Ignore IDictionary in abstract base class using Fluent Nhibernate Automap

I'm trying to ignore a property of type Dictionary in my abstract base class by doing this .Override<Item>(map => map.IgnoreProperty(x => x.Details)) ... I'm getting this error when doing so ... The type or method has 2 generic parameter(s), but 1 generic argument(s) were provided. A generic argument must be provided for each generic...

Default value is not setting on string column using fluent nHibernate mapping

Hi All, i am trying to set up default values for my columns using map file in fluentNhibernate. It is working for bool and int types but when i am setting the same for string type column , no matter what it sets it always null. here is how i am setting up the map file Id(x => x.DisplayID); Map(x => x.CanDetach).Default("false").Not.N...

Using a Join and Component together in Fluent NHibernate Mapping throws "Could not find a getter for property exception"

Using a Join and Component together in Fluent NHibernate Mapping throws "Could not find a getter for property exception". This is my C# code using FluentNHibernate.Mapping; namespace FnhTest { public class CustomerMap : ClassMap<Customer> { public CustomerMap() { Id(x => x.Id).GeneratedBy.Identity(); ...

Using Castle ActiveRecord with Fluent NHibernate?

Has anyone gotten Fluent NHibernate to work with Castle ActiveRecord? I am particularly interested in Automapping to configure entities for use with the ActiveRecordMediator repository. ...

Subclass of Subclass fluent nHibernate

Hi all My model looks like this: public class SelectionItem : BaseEntity // BaseEntity ==> id, timestamp stuff {//blabla} public class Size : SelectionItem {//blabla} public class Adultsize : Size {//blabla} I would like to use class-hierarchy-per-table-method of fluent nhibernate public class SelectionItemMap : BaseEntityMap<Enti...

Nhibernate entity with multiple Many-To-Many lists of the same type?

Does anybody know how I would map an entity with two many-to-many collections of the same child type. My database structure is this.... The "normal" relationship will be.... tbl_Parent col_Parent_ID tbl_Parent_Child_Xref col_Parent_ID col_Child_ID tbl_Child col_Child_ID The alternative relationship is... tbl_Parent ...

How do I use Fluent NHibernate with .NET 4.0?

I want to learn to use Fluent NHibernate, and I'm working in VS2010 Beta2, compiling against .NET 4, but I'm experiencing some problems. Summary My main problem (at the moment) is that the namespace FluentNHibernate isn't available even though I've imported all the .dll assemblies mentioned in this guide. This is what I've done: 1. I d...

Weird override problem with Fluent NHibernate and .NET 4

I recently asked a question about using Fluent NHibernate with .NET 4 - I solved that problem, but met a new one. Summary My main problem (at the moment) is configuring the database. I'm following this guide, but trying to work against SQL Server 2008 Express instead, as that's what I'll be using and thus what I need to learn. The fail...

NHibernate many-to-many assocations making both ends as a parent by using a relationship entity in the Domain Model

Entities: Team <-> TeamEmployee <-> Employee Requirements: A Team and an Employee can exist without its counterpart. In the Team-TeamEmployee relation the Team is responsible (parent) [using later a TeamRepository]. In the Employee-TeamEmployee relation the Employee is responsible (parent) [using later an EmployeeRepository]. Duplica...

Fluent NHibernate - need multi-program access to a single, lazy loaded SQLite database

I'm developing a project that has multiple programs that share a single, lazy loaded SQLite database file, using Fluent Nhibernate (Auto Mapping) as the data access layer. The first program I developed (let's call it Program 1) kept the Session open all the time, and lazy loading worked fine. This approach failed when I got Program 2...

What are the disadvantages of keeping the parent as a property of the child in Fluent NHibernate?

I'm using Fluent NHibernate/Automapping and I have a class that has a collection, and each item in that collection has its own collection. public class A { public virtual IList<ClassB> Items { get; set; } } public class B { public virtual IList<ClassC> ChildItems { get; set; } } This is related to this question, which was never...

Mapping a URI to string in Fluent NHibernate

(See this related question for LINQ-to-SQL) I'd like to map a class that has a URI member to a string column using NHibernate. How exactly might I accomplish that? I don't think the solution given to the related question works here - I can't declare a private field and map it, because the mapping needs to reference that field. ...

Nhibernate: mapping two different properties between the same 2 entities

I have a Class A: public class ClassA { public int ID {get; private set;} public string Code {get; private set;} public ClassB B {get; private set;} public IList<ClassB> ListB {get; private set;} } And a ClassB: public class ClassB { public int ID {get; private set;} public string Code {get; priva...