nhibernate

Where is the api reference for nhibernate?

I may be going mental, but I can not find any api reference material for nhibernate. I've found plenty of manuals, tutorials, ebooks etc but no api reference. I saw the chm file on the nhibernate sourceforge page, but it doesn't seem to work on any of my PCs (different OSes) Can someone please point me in the right direction? ...

Mapping table and a simple view with Fluent NHibernate

I have mapped a simple entity, let's say an invoice using Fluent NHibernate, everything works fine... after a while it turns out that very frequently i need to process 'sent invoices' (by sent invoices we mean all entities that fulfill invoice.sent==true condition)... is there a way to easily abstract 'sent invoices' in terms of my data ...

SQLite assembly not copied to output folder for unit testing

Problem: SQLite assembly referenced in my DAL assembly does not get copied to the output folder when doing unit tests (Copy local is set to true). I am working on a .Net 3.5 app in VS2008, with NHibernate & SQLite in my DAL. Data access is exposed through the IRepository interface (repository factory) to other layers, so there is no nee...

In which assembly I find namespace 'NHibernate.Proxy.Poco.Castle'?

In which assembly I find namespace 'NHibernate.Proxy.Poco.Castle'? I can find in NHibernate.dll the Proxy.Poco, but not Proxy.Poco.Castle... (using Nhibernate 2.1.2.4000). ...

Need help with SQL query on SQL Server 2005

We're seeing strange behavior when running two versions of a query on SQL Server 2005: version A: SELECT otherattributes.* FROM listcontacts JOIN otherattributes ON listcontacts.contactId = otherattributes.contactId WHERE listcontacts.listid = 1234 ORDER BY name ASC version B: DECLARE @Id AS INT; SET @Id = 1234; SELECT otherattribut...

NHibernate one-to-many mapping

I want to map one to many objects Person and PersonAddress public class Person{ public virtual int Id {get; set;} public virtual string FirstName {get; set;} public virtual ICollection<PersonAddress> PersonAddress { get; set; }} public class PersonAddress{ public virtual int Id {get; set;} public virtual int PersonId {get; set;} ... ...

many-to-many mapping in NHibernate

I'm looking to create a many to many relationship using NHibernate. I'm not sure how to map these in the XML files. I have not created the classes yet, but they will just be basic POCOs. Tables Person personId name Competency competencyId title Person_x_Competency personId competencyId Would I essentially create a List in each POC...

Is it possible to create ICriteria/ICriterion from LINQ or HQL?

I am creating a method that can create filter understood by NHibernate (by filter i mean a set of ICriteria object for example) from my abstract filter object. public static IEnumerable<ICriterion> ToNhCriteria(this MyCriteria criteria) { // T4 generated function // lots of result.Add(Expression.Or(Expression.Eq(),Expression.Eq)) ...

Can I set NHibernate's default "OrderBy" to be "CreatedDate" not "Id"?

This is an oddball question I figure. Can I get NHibernate to ask SQL to sort data by CreatedDate by default unless I set an OrderBy in my HQL or Criteria? I'm interested in knowing whether this sort can be accomplished at the DB level to avoid bringing in LINQ. The reason is that I use GUIDs for Ids and when I do something like this: ...

Intermittent HNibernate failure in unit test: "ExecuteNonQuery requires an open and available Connection. The connection's current state is open"

I have a suite of integration tests that run on top of my NHibernate 2.1 DAL. Recently, our CI server has been reporting intermittent test failures such as: System.InvalidOperationException: ExecuteNonQuery requires an open and available Connection. The connection's current state is open System.InvalidOperationException: Invalid attemp...

NHibernate : delete error

Hi, Model: I have a model in which one Installation can contain multiple "Computer Systems". Database: The table Installations has two columns Name and Description. The table ComputerSystems has three columsn Name, Description and InstallationId. Mappings: I have the following mapping for Installation: <?xml version="1.0" encoding=...

For SQL select returning more than 1 value, how are they sorted when Id is GUID?

I'm wondering how SQL Server orders data that is returned from a query and the Id columns of the respective tables are all of type uniqueidentifier. I'm using NHibernate GuidComb when creating all of the GUIDs and do things like: Sheet sheet = sheetRepository.Get(_SheetGuid_); // has many lines items IList<SheetLineItem> lineItems = sh...

"could not resolve property" exception while adding criteria for DateTime property

public class Entity { public virtual string Title { get; set; } public virtual DateTime CreationDate { get; set; } public virtual int Count { get; set; } } I have a problem when creating Criteria for a given entity: var s = session.CreateCriteria<Entity>() .Add(Expression.Ge("CreationD...

when using Automapper, Should I flatten/map my internal objetcs of the View Model also ?

Hi all, I am using AutoMapper in my project along with, NHibernate and ASP.NET MVC 2. As the title states, if I have a list of DTOs or a DTO inside the parent DTO that I am mapping to the View Model, should I flatten out the inner DTOs as well ? Edit: Should I write view model classes for the internal objects as well or should I use ...

Exclude specific value from a Min/Max aggregate function using ICriteria

I have a schedule (Voyages) table like this: ID Arrival Departure OrderIndex 1 01/01/1753 02/10/2009 0 1 02/11/2009 02/15/2009 1 1 02/16/2009 02/19/2009 2 1 02/21/2009 01/01/1753 3 2 01/01/1753 03/01/2009 0 2 03/04/2009 03/07/2009 ...

Castle ActiveRecord - schema generation without enforcing referential integrity?

Hi all, I've just started playing with Castle active record as it seems like a gentle way into NHibernate. I really like the idea of the database schema being generate from my classes during development. I want to do something similar to the following: [ActiveRecord] public class Camera : ActiveRecordBase<Camera> { [PrimaryKey] ...

Linq to NHibernate - How to return a parent object with only certain child objects included

Given a simplified model like the following: public class Enquiry { public virtual DateTime Created { get; set; } public virtual Sender Sender { get; set; } } public class Sender { public virtual IList<Enquiry> Enquiries { get; set; } } How can you construct a Linq to Nhibernate query such that it gives you back a list of...

FireBird .net provider 64bit

I'm trying to get a firebird web application (IIS6 64 bit) to run. However I'm getting bad image format (bit difference incompatability) issues. Has anyone got any advice to get it running. Details AnyCPU application references the .net firebird driver (through nhibernate) which uses a native 64bit dll. There is a native 32bit dll which...

Hibernate cascade delete on a bag

Howdy, Having built most of my DAL using NHibernate, I've now discovered that the SQL Server's Cascade On Delete rules also need to be taken into account in my HBM files too. I've been using bags for all my collections, but there doesn't seem to be a way to add a cascade="delete" attribute to a bag. I can change all my bags to sets, b...

nHibernate Criteria for selecting a parent if a child in a collection ahs a specific value

If I have the following class structure what is the NH criteria to select a parent if one of it's children has a specific name? public class Child { public int Id { get; set; } public int Name { get; set; } } public class Parent { public int Id { get; set; } public IList<Child> Children { get; set; } } ...