nhibernate

Nhibernate ICriteria API Reference

Is there any good ICriteria API overview? Chapter 12 from the official NHibernate reference is too short and I still don't have clear view of the ICriteria usage. ...

Enum and Nhibernate

Is it possble to use an Enum with Nhibernate? If so How? ...

Quartz.net + NHibernate + Windsor.Castle + CommonServiceLocator

Hi, I have a web application based on the sharp-architecture framework. It actually use NHibernate for the dal, and i've added a service layer between the (VIEW-CONTROLLER) and the DAL. I actually need to implement a scheduler to run my jobs frequently. I will use Quartz.net to do that task. Actually i'm facing a problem. Because I wil...

NHibernate connection/reader closed from ajax context

I have run into trouble using NHibernate when I am doing ajax calls using JQuery. I get different exceptions regarding either the connection or reader being closed like: "Invalid attempt to call Read when reader is closed". Does anybody know how to fix this? ...

How to specify table name in Fluent NHibernate ClassMap class?

Hi I am newbie to NHibernate and trying to use Fluent for mapping. My entity class name is different from the database table name it has to be mapped to. I am using mapping class derived from ClassMap<>, but I can't specify the table name: the property TableName from ClassMap is read-only. Thanks for your help. ...

Can you use auto-increment in MySql with out it being the primary Key

I am using GUIDs as my primary key for all my other tables, but I have a requirement that needs to have an incrementing number. I tried to create a field in the table with the auto increment but MySql complained that it needed to be the primary key. My application uses MySql 5, nhibernate as the ORM. Possible solutions I have though...

NHibernate - 12 Months / 1 Year and DataBinding

What is the best way to handle this I have an application where I constantly have to "pivot" 12 month records into one year record/object to be able to display a single year per row in a DataGrid. I have been doing this work up until this point in DataSets with some ugly T-SQL to get the pivot to happen. I'm upgrading this application t...

Oracle stored procedures, SYS_REFCURSOR and NHibernate

I have a legacy Oracle (10.2g) database that I'm connecting to and I'd like to use NHibernate (2.0.1) to give me back objects from a stored procedure. The stored procedure in question uses a SYS_REFCURSOR to return results. According to the documentation this should be doable but I've found a few posts on the internet that suggest otherw...

Fluent NHibernate HasManyToMany and NotFound

I have the following FNH mapping fragment: HasManyToMany((c) => c.Plaintiffs) .LazyLoad() .WithTableName("invoicePlantiff") .WithChildKeyColumn("PersonReferenceID") .WithParentKeyColumn("invoiceID") .FetchType.Join(); Which produces the following HBM: <bag name="Plaintiffs" access="iServe.Design.CslaNHibernate...

What is the best cache for Nhibernate when using an MVC web app?

Hi, if you were using Nhibernate for data access in an MVC app what would be the best cache provider e.g. Syscache,Syscache2,Memcache,HashTable.. to use? Thanks for your opionions. ...

NHibernate Projections and "Having" clause

I'm using NHibernate to query my database with the criteria API. My criteria is below: ICriteria c = Session.CreateCriteria(typeof(Transaction)); ProjectionList projections = Projections.ProjectionList(); projections.Add(Projections.Sum("Units"), "Units"); projections.Add(Projections.GroupProperty("Account"), "Account"); projections.Ad...

nHibernate (w/ Castle ActiveRecord) with C# interfaces (esp for DTO's)

Any using nHibernate with a Domain object & DTO object implemented from a common interface? I'm trying to separate all of my nHibernate attributes into the Domain object, leaving my DTO's and interface clean. The problem comes with nHibernate throwing errors when it tries to associate the interfaces with the concrete classes. NHibernat...

Fluent nHibernate and JoinSubClasses

I am not sure if this a problem with my Fluent configuration or some logic in my thinking. Basically I have a Person class from which I have two inherited classes, Author and Borrower (it's a library system). The mapping I have is. public class PersonMap : ClassMap<Person> { public PersonMap() { Id(x => x.Id, "id"); ...

NHibernate set mapping is not DRY?

I'm not an advanced NHibernate user, so this may be somewhat important, and I just didn't discover it yet.. but what the heck. Consider the class: public class House { public int Id { get; set; } public ISet<Room> Rooms { get; set; } } When specifying NHibernate Set element it's not enough to write: <set name="Rooms" /...

Can nHibernate Generate Value For Property?

Id columns can specify a generator. Perfect. However, I have a situation in which I need to assign a generated value to a property column if it is null. Think something along the lines of an invoice table where there's a surrogate primary key column and an Invoice Number column. CREATE TABLE dbo.Invoice (InvoiceId INT NOT NULL PRI...

How to map uint in NHibernate with SQL Server 2005

I have a property of type uint on my entity. Something like: public class Enity { public uint Count {get;set;} } When I try to persist that into the SQL Server 2005 database, I get an exception Dialect does not support DbType.UInt32 What would be the easiest way to workaround this. I could for example store it as long in the ...

Nhibernate one-to-one mapping a class with itself

We have a situation where we want to define a relationship where a class (named Module) may or may not be related to a Module object that is a predecessor to it. There can be zero or none predecessors. The class looks like this: public class Module { public int Id { get; set; } // other stuff here ...

what is the best location for me to put nunit tests for a library which must be used from both ASP.Net and WinForms

I have an infrastructure library which must be used from both WinForms and ASP.Net. I would like to wrap this up in some unit tests. Which project do I put these in? Do I use another folder in my library project? A different solution which contains only my infrastructure project and a separate unit testing project? Incidentally, I wi...

Doubly connected ordered tree mapping using NHibernate

Hello, everyone! We need to map simple class using NHibernate: public class CatalogItem { private IList<CatalogItem> children = new List<CatalogItem>(); public Guid Id { get; set; } public string Name { get; set; } public CatalogItem Parent { get; set; } public IList<CatalogItem> Children { get { return...

Need an example of a "Good Line of Business Application" for .NET that uses ORM

I'm trying to move toward TDD, ORM, Mocking, ect. I need a good example of a line of business app that uses an ORM preferably NHibernate. It has to be open source and use the repository pattern. I learn best by example, I have played around with the repository pattern and unit of work pattern but not in any meaningful applications. I'...