nhibernate

NullReferenceException when initializing NServiceBus within web application Application_Start method

I am running the 2.0 RTM of NServiceBus and am getting a NullReferenceException when my MessageModule binds the CurrentSessionContext to my NHibernate sessionfactory. From within my Application_Start, I call the following method: public static void WithWeb(IUnityContainer container) { log4net.Config.XmlConfigurator.Configure(); ...

How do I return a bit from a stored procedure using nhibernate

I am using nHibernate in my project but I have a stored procedure which just returns a boolen of success or now. How do I code this in c#? I have tried the following but it doesnt like cause I dont have a mapping for bool!!! {"No persister for: System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c5...

ASP.NET MVC image upload store location (db vs filesystem)

I am writing web application using ASP.NET MVC + NHibernate + Postres stack. I wonder if images uploaded should be stored in database as binary blobs or on filesystem (and reference only in db). One advantage of db storage I can think of is easy backup/recovery of all data without reverting to filesystem copy tools. On the other hand I ...

Problem getting Nhibernate Facility + Update/Save event listeners working

I really can't get this working so i'm hoping someone here can help :) here is my castle.config: <castle> <facilities> <facility id="nhibernatefaciltity" isWeb="true" type="Castle.Facilities.NHibernateIntegration.NHibernateFacility, Castle.Facilities.NHibernateIntegration"> <factory id="sessionF...

Finding parents where child collection does not contain an item with a specific property value

I am trying to get a list of parents where the child collection does not contain an item of a specific type. The LINQ equivalent would be something like: dataset.Where(x => x.Items.FirstOrDefault(y => y.Type.Code == "ABC") == null) The object model is Parent > Child (Items) > Type > Code If Parent is my aggregate root, how would I m...

NHibernate: Dynamically swapping a single domain model between multiple physical data models

Hi In this article Ayende describes how to map a single domain model to multiple physical data models. Is it possible to extend this principle such that the mapping can chosen dynamically? So for example, imagine we had an entity that could be written to the same physical schema in three ways depending on its current status, and lets a...

How to get hold of the current NHibernate.Cfg.Configuration instance.

My C# project has repositories that are instantiated using dependency injection. One of the repository methods needs access to the NHibernate.Cfg.Configuration instance (to generate the database schema) that was returned when initializing NHibernate. I cannot pass the configuration to the repository however, because that would break th...

Is it possible to mimic IQueryable with NHibernate?

Is it possible to mimic IQueryable with NHibernate? I was looking at Nhibernate docs and for what i could tell, it always returns a List of objects, that have it's attributes indexed by a integer. Ok, perfect, that works. But is there a way to retrieve objects like LINQ? With something like IQueryable? Thanks ...

Nhibernate 3.0 and FluentNHibernate

is anyone building the truck NHibernate and FluentNhibernate together? How's it working? are you using it for production systems? How is the Linq support? Is it nearly ready for release? Is there a nice and concise way to keep up to date with what is going on in the world of NHibernate? (ie, without having to read lots of blogs, and...

Nhibernate: One-To-Many mapping problem - Cannot cascade delete without inverse. Set NULL error

Hi, I have the current scenario whereby an Article has only 1 Outcome each. Each Article may or may not have an Outcome. In theory, this is a one-to-one mapping, but since NHibernate does not really support one-to-one, I used a One-To-Many to substitute. My Primary Key on the child table is actually the ArticleID (FK). So I have the f...

How do I update with a newly-created detached entity using NHibernate?

Explanation: Let's say I have an object graph that's nested several levels deep and each entity has a bi-directional relationship with each other. A -> B -> C -> D -> E Or in other words, A has a collection of B and B has a reference back to A, and B has a collection of C and C has a reference back to B, etc... Now let's say I want ...

Eval(), can only be used in the context of a databound control Error. Why it happens? What can I do about it?

Hi there, I am getting the following error, Using asp.net and nHibernate. Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control. I have this listview <asp:ListView ID="CurrentHourList" runat="server" ItemPlaceholderID="itemPlaceholder"> <LayoutTemplate> ...

What are the main benefits of the Versioning feature in NHibernate?

In other words, what are the main reasons to use it? Thanks ...

MonoRail: Testing, Route Extensions, Folder Structures

I've got a few questions related to the use of MonoRail Testing Does everyone tend to use NUnit for their testing? I haven't worked enough with testing to know if this is a good testing framework to use. I'm just looking to get more into testing my applications a lot more than before and wanted to know if there's any general guideline...

nhibernate many to many deletes

I have 2 classes that have a many to many relationship. What i'd like to happen is that whenever i delete one side ONLY the association records will be deleted with no concern which side i delete. simplified model: classes: class Qualification { IList<ProfessionalListing> ProfessionalListings } class ProfessionalListing { ...

NHibernate - Get entity property column name

How to get table COLUMN NAME for some entity property? ...

please explain NHibernate HiLo

I'm struggling to get my head round how the HiLo generator works in NHibernate. I've read the explanation here which made things a little clearer. My understanding is that each SessionFactory retrieves the high value from the database. This improves performance because we have access to IDs without hitting the database. The explanation...

c# dynamic proxy

How determine in C# if an Object is the original object or a dynamic proxy of the original object? I run into this need playing with nhibernate. ...

Prevent mapping all public members of a class in Fluent NHibernate

I have a class generated from a WSDL that has a bunch of public properties and a public event. I'm extending this class with my own and adding some properties to it. All of my own properties are declared virtual, but the base class properties are not virtual. I'm using Fluent NHibernate's ClassMap to map only the properties from my exte...

Discriminator based on joined property

Suppose I have this relationship: abstract class Base { int Id; int JoinedId; ... } class Joined { int Id; int Discriminator; ... } class Sub1 : Base { ... } class Sub2 : Base { ... } for the following tables: table Base ( Id int, JoinedId int, ... ) table Joined ( Id int, Discriminator int, ... ) I would like to set up a table-per...