fluent-nhibernate

How do you map an enum as string in fluent nhibernate?

Is it possible to map an enum as a string using Fluent Nhibernate? ...

Fluent Nhibernate mapping inner join on 3 tables

Datastructure is: Table[Questionnaire] the top node Table[QuestionGroup] just a grouping for heading etc Table[QuestionnaireQuestion] mapping [Question]<->[QuestionGroup]s many to many relationship and the [Questionnaire]<->[Question]s many to many relationship Table[Question] One question can exist in many questionnaires/questiongro...

Mapped Objectified relationship with nhibernate can not initialize collection

I'm mapping a objectified relationship (the many->many mapping table contains properties), following this guide. The sql generated(see exception) is working and returns what i want(strictly speaking it should have been an inner join?). But i get a GenericADOException saying: could not initialize a collection: [Questionnaires.Core.Ques...

NHibernate: Using Fluent Nhibernate to save child objects

Hello, In my system, I have two entities - ShoppingCart and ShoppingCartItem. Fairly generic use-case. However, when I save my ShoppingCart, none of the items are being saved to the DB. Within my object, I create a new ShoppingCart object. ShoppingCart cart = CreateOrGetCart(); I then add an existing Product which I got from the data...

Fluent-NHibernate mapping

In my database I have field containg a comma delimited list of emails. How would I map that to a IList<string> in my model ? ...

ASP.NET MVC + fluent nNibernate, what IoC tool?

I'm working on a ASP.NET MVC project where we have decided to use Fluent nHibernate for dataccess. To enable loose coupling we go for a IoC/DI pattern. My questions is what IoC tool to go for. I've tried to find the differences between windsor, ninject, spring, structuremap and unity, but it's difficult to see the benefits each one has t...

Fluent NHibernate many to many convention for type

Hi, Im using the AutoPersistenceModel in Fluent NHIbernate to map all my entities and that all works fine :D However, several of my objects have public virtual IList<Comment> Comments { get; set; } In the database there is a single comments table, and each entity with the above code, has its own link table to comments. At the momen...

Fluent NHibernate + Lucene Search (NHibernate.Search)

I'm using Fluent NHibernate and I would like to implement NHibernate.Search with Lucene but I can't find any examples on how to do that with Fluent NHibernate. It appears there are two steps. (According to Castle) Set the Hibernate properties in the configuration: hibernate.search.default.directory_provider hibernate.search.default.i...

Fluent NHibernate one to many uni-directional mapping

I have Post and Comment classes, and they have a one to many relationship where Post has a list of Comments. How can I map this as a uni-directional relationship with Fluent NHibernate, since a comment does not need to know its parent Post? Currently, this is my mapping for Comment: Id(x => x.Id); Map(x => x.Body); References(x => x.Us...

NHibernate one-to-many problem

I have a Vessel object that has a one-to-many relationship with a VesselDetail object. When I add a VesselDetail object to the Vessel object and try to save the Vessel object, it seems NHibernate does not add the foreign key when inserting the VesselDetail object. Where am I going wrong here ? I just cannot figure it out. Error messag...

Fluent NHibernate - how to configure for oracle?

Almost certainly a stupid question but I can't find the answer anywhere. In the Getting Started tutorial the database is SQLite and so his session factory creation is done using the SQLiteConfiguration class in the FluentNHibernate.Cfg.Db namespace Great! But I don't see a Configuration class for using an Oracle database. How do I do...

NHibernate Eager loading multi-level child objects

I have a hierarchy of objects, Order, Contact, Address: public class Order { public virtual Contact BillingContact { get; set; } } public class Contact { public virtual Address Address { get; set; } } I want to query an order by id, and eager load the billingcontact, along with it's address. var criteria = DetachedCriteria...

Fluent NHibernate: How to map a db integer to a datetime column?

I have a class public class Site { public DateTime SiteMonth {get; set;} } in the database the SiteMonth is represented as an integer in yyyymm format. Is there a way to map this in NHibernate without introducing a new property on my Site class? ...

Using NHibernate/FluentHibernates save with table as parameter.

I have a collection of Answer's (IList<Answer>) and two tables(Answer and AnswerHist). I want to do something along the lines of: Get the current answers from db. save(Answers, "AnswerHist"); delete(Answers, "Answer"); Answers = questions .Select(x => new Answer(response) { ...

NHibernate - not-null property reference a null or transient value

I'm getting this exception (Full exception at the bottom): NHibernate.PropertyValueException was unhandled by user code Message="not-null property references a null or transient valueClearwave.Models.Encounters.Insurance.Patient" Source="NHibernate" EntityName="Clearwave.Models.Encounters.Insurance" PropertyName="Patient" I've don...

How does one map multiple classes to one table through NHibernate?

I have an Employee class with a Name property of class Name and a Contact property of type Contact. The Name class has two string properties: FirstName and LastName and the Contact class has properties like PhoneNumber and EmailAddress. All of the data is found in one table and assume that it cannot be changed. What would my maps look...

Fluent NHibernate from appSettings

I want to configure my NHibernate Fluent from a app.config and a appSettingKey. Is there someone who can explain how the file: app.config, will look like MsSqlConfiguration.MsSql2005 .ConnectionString(c => c .FromAppSetting("appSettingKey")); And this is my connectionsString: Data Source=(local);Initial Catalog=ABC;Integrated ...

one-to-one fluent nhibernate?

Is it possible yet to do a one-to-one mapping with fluent nhibernate? I have the following as part of an hbm that I'm trying to convert to fluent: <one-to-one name="Person" property-ref="FileData" constrained="true"/> I see a OneToOnePart<OTHER> in the code but i'm not sure how or if this is used to accomplish this. Thanks! ...

Unmapped Columns in NHibernate?

I'm working with a legacy database in Oracle and some of my tables have columns that are set to NOT-NULL that I don't want in my domain model, but, obviously, I need to specify somewhere that at least some default value is saved to the database (eg a Groups table may have a "Indentation" column thaqt always expects a char(8) value). How...

fluent nhibernate select n+1 problem

I have a fairly deep object graph (5-6 nodes), and as I traverse portions of it NHProf is telling me I've got a "Select N+1" problem (which I do). The two solutions I'm aware of are Eager load children Break apart my object graph (and eager load) I don't really want to do either of these (although I may break the graph apart later ...