nhibernate

How can I use "Expression.Not" with text field?

How can I use "Expression.Not" with text field? I need to select all records from NHQuestionCount except "ktest" for example this code return runtime error NHQuestionCount[] stats = NHQuestionCount.FindAll(Order.Asc("NameFull"), Expression.Not(Expression.Eq("NameFull", "ktest"))); ...

Getting latest entries for each entity using HQL?

I'm having some problems with getting NHibernates HQL to behave the way I want. I have two tables, lets call them X and XLOG. There are multiple XLOG entries for each X. X: - Id XLOG: - Id - X_Id - Timestamp I want to write an HQL query that will produce the latest XLOG entry for each X. In SQL, I could either make a correlated...

After upgrading to Castle Trunk and NHibernate 2.1.0.4000 My Integration tests crash TestDriven.Net

I have an old MonoRail/ActiveRecord I've been doing some work too. Recently I decided to upgrade the application to Castle Trunk & NHibernate 2.1.0.4000 GA and I'm now finding a few issues with running tests: First off - When using TestDriven.Net to run the integration tests that work against the database, it's crashing TestDriven.Net ...

NHibernate Criteria, select by count of property

Sorry for the cryptic title.. Could you help me out, on how do a select, based on the count of a property, using Criteria? I have an object (Pool) with a property (PoolItems), and i want to select all the Pools w. more than 5 PoolItems. ...

How should I be configuring spring and hibernate so that my Integration Tests replicate properly the behaviour of the Web application ?

We have a web application based on NSpring 1.2 and NHibernate 2 and use HibernateTemplate. The web application is configured to use OpenSessionInViewModule. In our integration tests however the hibernate session is marked as InitDeferredClose and for the most part this works fine for our tests. There are some service functions that w...

Is there a workaround for the unsupported IParameterizedType in Fluent NHibernate?

Fluent NHibernate is currently unable to use the IParameterizedType of a CustomType but I need to use the fluent mapping because I want to adjust the mapping within my code. Is there a workaround for Fluent NHibernate that somehow injects the XML elements that would be used within the normal mapping XML-file? I did already find the sim...

Fluent nHibernate reference mapping question

I need a clue how to map my Invoice class. public class Buyer { public virtual int Id { get; set; } public virtual string Name { get; set; } public virtual string TaxRegNo { get; set; } // .... more properties.... } public class Invoice { public virtual int Id { get; set; } public virtual int IdBuyer { get; s...

Advanced search with distances using NHibernate and SQL Server Geography

I've got an existing advanced search method in a repository that checks a FormCollection for the existence of search criteria, and if present, adds a criterion to the search e.g. public IList<Residence> GetForAdvancedSearch(FormCollection collection) { var criteria = Session.CreateCriteria(typeof(Residence)) .SetResultTransformer(...

Help in building nhibernate from source

I downloaded nant 0.86 beta which seems to be the latest release. Now running: nant default.build I get this error: detected nant 0.86 beta 1, consider upgrading to a newer version when building for .net 3.5 default.build does not exist in this project What am I doing wrong here? Update downloaded the nighly build, now running: na...

Can find the SVN branch for the current release of nhibernate

The download is 2.1.2GA, but I can only see 2.1.x in a subversion branch. https://nhibernate.svn.sourceforge.net/svnroot/nhibernate/branches/2.1.x/nhibernate any ideas where I can download what they are releasing? ...

Storing an ordered child collection in NHibernate

I'm having trouble getting my head around the way I should implement an ordered child relationship with NH. In the code world, I have: class Parent { public Guid Id; public IList<Child> Children; } class Child { public Guid Id; public Parent Parent; } A Parent has a list of Child[ren] with an order. In reality, the C...

Nhibernate in asp,net ISession help

We're using nhibernate in and asp.net MVC application. We are implementing the Session per Request pattern, via a httpModule. It looks pretty straight forward, but when we run with NHibernate Profiler, it clearly shows that the sessions are never getting closed. the pattern seems straight forward...but I don't understand why the sess...

HQL to CriteriaQuery when using bitwise operators

How do I convert this into a CriteraQuery: select n from TagRegistration t join t.Tag n where t.Status & :status > 0 order by count(t.ID) desc , n.Name asc ...

Nhibernate Session and ASP.NET

Using NhibernateProfiler we have determined that we are creating an ISession for every http request. However the ISessions never close. We can see in the log where localSession.Close() fires. Is there something in our config file that would cause the session to never close? Are there any other reasons localSession.Close(...

Connect NHibernate to different databases with same schema

We are in the process of splitting our db into several smaller ones. The schemas will be exactly the same and we will control which db the system connects to when the client logs in. I receive an error if I do not set a connection string in my nhibernate configuration. I do not want to create a factory for each db. Is it possible to hav...

unit testing / integration guidance for a shopping cart

Need some guidance on how to go about unit testing a shopping cart (.net mvc, c#). I want to use sqllite as I am using nhibernate so I can create an in-memory version of my database for integration testing. So I have a Cart object: public class Cart { void Add(Item item); void Delete(Item item); void CalculateTotalB...

NHibernate - Do I have to have a class to interface with a table?

I have a class called Entry. This class as a collection of strings called TopicsOfInterest. In my database, TopicsOfInterest is represented by a separate table since it is there is a one-to-many relationship between entries and their topics of interest. I'd like to use nhibernate to populate this collection, but since the table stores ve...

Problem integrating WCF with Sharp architecture

I'm working with an application which uses wcf and sharp architecture, I'm trying to create a service to write to the database. Here is my service: [ServiceContract] public interface IFacilitiesWcfService : ICloseableAndAbortable { [OperationContract] void AddFacility(string facility); } [AspNetCompatibilityRequirements(Requir...

T-SQL CONVERT() Equivalent in NHibernate Mappings for VARBINARY to VARCHAR

I'm building an ASP.NET web application using NHibernate and a legacy database. In that database are fields of HTML stored as VARBINARY(MAX). The existing queries cast that data using CONVERT(VARCHAR(MAX), mainText). How can I do the same using NHibernate's HBM mapping? ...

Advice on UnitOfWork with NHibernate and/or Web Service

Hi, I'm looking for some advice for the following. I need to create a DAL that is interchangeable between a database and a webservice. I'm developing in C# and WPF. has anyone see any good implementations of an IUnitOfWork and allows different DAL to be switch in or out using some sort of DI? EDIT So after doing some reading. I'...