nhibernate

Do I need external 2nd level cache for multiple NHibernate instances in Windows Azure?

I am developing AMF Flash gateway on FlourineFx application for deployment on Windows Azure and I want to use Azure SQL. I use NHibernate 2.1 + NHibernate.Linq 1.0 + FluentNHibernate 1.1 There will be two or more instances of this FlourineFx gateway and only 1 database. I am planning on implementing memcached as 2nd level cache later ...

Do I need to call SaveOrUpdate() after calling Merge()?

for reference I'm using version 2.1.2.4000 of Nhibernate. I've spent pretty much an hour or so reading up the difference between Merge() and SaveOrUpdate() and no explanation attempts to just answer a really simple question?? I know that Merge() will do all the magic to synchronize the detached objects with cached or out of date instan...

Eager Loading of Tree / Hierarchies using Nhibernate

Hi This is not a question as such, I have been reserarching this subject for the last few days and thought I would like to contribute something that pulled in a lot of the disparate ideas that I've beed reading about and put forward my solution to the problem... The problem being eager loading of n level child objects within Nhibernate...

NHibernate Unit Of Work Example

I am looking for a very Simple HTTP module I can look at as a starting point for my MVC/NHibnerate Project. I am just looking for something that has some simple transaction support and handles opening a session factory and closes it on a per request biases. Has anyone seen a good example of this? I have googled around quite a bit and ha...

NHibernate and SQL Server 2008 encryption

How to perform SQL Server built-in encryption/decryption with NHibernate? I mean encryption of separate columns. ...

How to implement a cross-database foreign key constraint?

Let's say I have two schemas: HR and Orders. [HR].Employees [Orders].Entries -------------- ---------------- Id_Employee ----> Employee Fullname Id_Entry Birthday Description Amount As you can see, what I'd want is to be able to establish a cross-database foreign ...

Session Per Presenter NHibernate Desktop App - Not loading latest data from database

I'm writing a WPF NHibernate Desktop App using Session Per Presenter. I have a list view showing all the saved SalesOrders and an Edit Sales Order form when you double click on a Sales Order. Each of these forms has a Session Object which lasts for the lifetime of the form. When a SalesOrder is saved it publishes an Event which tells th...

NHibernate and AutoMapper

What is the best way to run raw SQL against NHibernate, then push it into List using AutoMapper? Example: public virtual List<T> GetList<T>(string mainsql) { IQuery q = GetSession().CreateSQLQuery(mainsql); IEnumerable srcAllRows = q.List(); List<T> targetAllRows = new List<T>(); *** do AutoMapper thing to get srcAllR...

How does NHibernate determine whether to Insert or Update a record?

When using Session.SaveOrUpdate(myEntity); how does NHibernate decide how whether to insert a new record or update an existing one? I am having trouble whilst saving one object in a S#arp project. It is retrieved from storage, then stored in session state for a couple of web requests, then saved back to the database with one property ch...

Securing/omitting selected properties of a domain entity in NHibernate (subclass, projection, ?)

Consider the following simplified scenario: public class Person { public string Name { get; set; } public int Age { get; set; } // restricted public string SocialSecurityNumber { get; set; } // restricted public string MothersMaidenName { get; set; } } So, in the application, many users can view Person data....

No component for service in NHibernate web application

I am using NHibernate in my web application. At one point it enters a loop (multiple threads may be looping) where it makes many calls to the database. It works fine for a while then will fail with the following error (when I call UnitOfWork.Start()): No component for supporting the service Rhino.Commons.IUnitOfWorkFactory was foun...

NHibernate Custom Collections hack works outside of a transaction, but not inside

Following the technique described here, I was able to populate a domain object that uses custom collections for its children. The relevant property mapping looks like this: <component name="Contacts" class="My.CustomList`1[[Domain.Object, DomainAssembly]], MyAssembly"> <set name="InnerList"> <key column="PARENT_...

FluentNhib + System.Data.SQLLite VS2010

I know this question has been posted here before, and I've trawled through as many answers as I could find, but I still can't get the simplest test in the world working. 1) I created my test and ensured it was working in in VS2008 and then opened the the solution in VS2010 (so it's all definlaty working, and all 3.5 code with all the as...

nHibernate + wcf + Isession

I have a c# solution with 3 projects - Data, WCF and UI. The first one is a class library that talks to db. It's exposed via the second one, which is of type WCF Service Library - the reason for that is it will be exposed in third project - Asp.net app called UI - as a simple svc pointing to dll. Just to point it out, I'm not using Repo...

Castle ActiveRecord Oracle blob query problem

Hello, I am using Castle ActiveRecord for .NET version 2.1. for access to an Oracle Express 2008 database. I have a table with a BLOB column mapped like this. [ActiveRecord("DOCUMENTS", Lazy=true)] public class DOCUMENTS : ActiveRecordBase<DOCUMENTS> { private long id_document; [PrimaryKey(SequenceName = "seq_D...

In a Multi threaded application all threads acquire connection to database .Is this expected or some problem ????

I am using NService and NHibernate for my Application. As for NServicebus we define number of threads in configuration file. As per the worker's number of threads it works in multithreaded environment. Sometime when all threads are in use and threads acquires connection with database ,it does not allow application to...

Orderby on an Iesi set

Hi Is there any way to perform a Linq OrderBy on a column in an OrderedSet (Iesi.Collection) and get the output as an ordered set. There appears to be no way to convert between IOrderedEnumerable and ISet... Thanks ...

Order By in nhibernate column mapping

Hi I have a parent - child node pattern the parent node has a collection of children nodes. The nodes have a property of position for ordering. I use this position property in my mapping file to order by. This works ok until I come to eager load the children which creates an left outer join and the position column is then ambigous. I ha...

Add/delete item to bag collection

I am working with nHibernate, and trying make sense of bag collections. My data structure is relatively straight-forward... Entry: <class name="Entry"> <id name="id" column="EntryId"> <generator type="guid.comb"/> </id> <property name="Name" column="Name"/> <bag name="Results" table="Results" cascade="all"> <key column="Ent...

NHibernate 3 - what is the status?

I am an NHibernate newbie so I apologize if there is an obvious answer to this that I'm missing. I see some questions on SO and some blog posts referring to NHibernate 3. But when I go to nhforge.org, it looks like the current downloads are for 2.1.2. Is 3 still a work in progress? Are there betas available somewhere? Documentation?...