fluent-nhibernate

does fluent nhibernate support lazy loading of proerties

i have a person class with a photo property and i want to load just that one property in a lazy fashion. i see that regular nhibernate supports it here. is this possible in fluent nhibernate to use this feature ...

Fluent NHibernat - Querying enum field with LINQ

Hi, my application has the following database structure: Transactions: - TransactionID (PK, Identity, Int) - TypeID (FK, Int) - Amount (Decimal) TransactionTypes: - TypeID (PK, Identity, Int) - Type (NVarChar) The are defined in my application as: public class Transaction { public virtual int TransactionID { get; set; } publ...

customize error message for nhibernate

when deleting an entity in nhibernate i get an exception with this error message: delete statement conflicted with column reference constraint ..etc of course the exception is wrapped in long series of exceptions. the error message is normal, but can i make nhibernate shows more polite error message to the user ?? in another words: is t...

Are all NHibernate References LazyLoaded by default?

I have a (fictional) class with Fluent-mapping: public class Customer { public virtual int Id { get; set; } public virtual string Name { get; set; } public virtual Employee Responsible { get; set; } public virtual IList<Order> Orders { get; set; } } public class CustomerMapping : ClassMap<Customer { public Cus...

Multiple row update in nhibenrate

Hi guys, So I was wondering whether it is best to update multiple rows in a database using an hql query or calling nhibernates save after modifying each object.. I know that the answer is the HQL query but please give me adequate reasons for the same. but there are disadvantages of using an HQL query right like my API has a hard depend...

Castle 2.5/NHibernate/Magnum/NServiceBus

Hi, Is there anyone out there having a working Castle 2.5 based stack including NHibernate (2.1.2.x), FluentNHibernate, Magnum, NServiceBus, rRhino.Security up and running built for .Net 4? thanks in advance & greetings, chris ...

Fluent nHibernate Eager Load one class

Hi, How do I Eager load a collection of objects in Fluent nHibernate? I going to loop through the collection and at the moment I'm getting an individual database call on each loop. I'm using the auto mapper have this override public void Override(AutoMapping<ParticipantCompany> mapping) { mapping.Not.LazyLoad(); } bu...

What's the best way to implement a fulltext search for an ASP.NET MVC application?

I've built an ASP.NET MVC application with MVC 2.0 and Fluent NHibernate (hided behind repositories for some reasons). The application represents a quite complex domain with some different objects like users, messages, comments, files and appointments. Now I want to implement a fulltext search which is enabling the user to find easily a...

One to one self reference with Fluent NHibernate

Okay, I think I have a scenario I haven't seen elsewhere. I have a situation where I have an object type that needs to be able to be changed over time while retaining the history of the changes within the same table (as opposed to just in an audit table). public class Item { public virtual int Id { get; set; } public virtual...

NHibernate, i invoke delete but update is invoked automatically!!

in NHibernate, i invoke delete but update is invoked automatically!! i use FluentNhibernate Automapping. ...

Setting up Fluent NHibernate and StructureMap for a web application

I use this approuch http://www.kevinwilliampang.com/2010/04/06/setting-up-asp-net-mvc-with-fluent-nhibernate-and-structuremap/ for setting up fnh with structuremap but after one request I get the following exception Session is closed! Object name: 'ISession'. Description: An unhandled exception occurred during the execution of the curr...

Fluent Nhibernate - Generate a non-primary-key sequence generated value

I have an entity mapping quite similar to this one. public class MyClassMap : ClassMap<MyClass> { public MyClassMap() { Id(x => x.Id); Map(x => x.Code); Map(x => x.Name); Map(x => x.Description); } } I'd like to know if there's any possible way to have the Code field (which is not part of t...

Fluent NHibernate Mapping - State Pattern

Hi, I'm not too hot on NHibernate / FNH Mapping but I am looking at implementing the state pattern and like the idea of Derick Bailey's article here: I beleive this was a while ago so the mapping code is out of date, can someone give me a hand to update it for FNH 1.1? public class OrderStatusMap: ClassMap<OrderStatus> { public Ord...

Nhibernate class mappings

Question: I have the below nHibernate mapping via attributes. Now I want to create T_lsDomains with a dynamic table prefix. Such as TBL_lsDomains or just lsDomains. Is there any way I can do this with attributes? Since they are defined at compile time, and must be constant? Is there any way to do this? Or can fluentNhibernate do thi...

Using nhibernate to filter by the value of an object in a child collection.

Here's the setup. NHibernate, Fluent NHibenrate and Nhibernate Linq The entities invoved are Fault - a record of a fault occuring Alarm - information about the fault, think of it as a fault type ( a list of all possible faults that can occur ) AlarmDescription - human readable description, one for each language A fault has an alar...

NHibernate - Many To One - NHibernate.LazyInitializationException - Could not initialize proxy

I am getting this exception when I attempt to access an object that is stored in a property of my domain object. I have done some research and still do not understand why I am getting this error. I have a very basic repository in which I am creating a session and then using a ICriteria query to fetch the first record from the list of r...

Fluent NHibernate + AutoMappings: Mystery Column in Generated SQL

I'm getting a SQL query from NH, and it's generating a column that does not exist (thus producing an ADOException from NH). SELECT roles0_.CreatedBy_id as CreatedBy4_1_, roles0_.Id as Id1_, roles0_.Id as Id18_0_, roles0_.RoleDescription as RoleDesc2_18_0_, roles0_.User_id as User3_18_0_ FROM [Role] roles...

persiste the deletion operation from a collection in NHibernate

When i delete some object (or remove it) from a collection (such as list) and call SaveOrUpdate from the parent of this collection the row of the child isn't removed but updated by setting the foreign key value to NULL. How can i force it to be deleted (the child row). ...

how do i automap an many-to-one relationship using fluent nhibernate

i have the following class: public class Worker { public int WorkerID {get;set;} public string Name { get;set;} } public class TransferOrder { public int TransferOrderID { get;set;} public Worker workerTobeTransfered{get;set;} } how do i automap this classes in fluent nhibernate. ...

in fluent-nhibernate,saving a many-to-one entity, why i should give a version to the referenced entity.

i have the following entities: public class Worker { public int WorkerID {get;set;} public string Name { get;set;} public int version { get;set;} } public class TransferOrder { public int TransferOrderID { get;set;} public Worker workerTobeTransfered{get;set;} public int version { get;set;} } and i am using the Auto mapp...