nhibernate

Fluent NHibernate Join with Constraint

i have an entity with its properities spread over two tables that i'd like to map to one class using Fluent NHibernate, but with a constraint on the joining table. i've changed the domain of my problem for this question to be the familar 'customer' domain, so my example here may seam a little contrived, but it illustrates my problem. it...

To use SQLite in memory with NHibernate, do I have to install anything?

I know NHibernate has a driver for SQLite, but what do I have to install locally to use the in-memory version? ...

when nhibernate generates a schema, what about other indexes besides PK and FK

If I let nhibernate generate the schema, what about other indexes I may put on the tables for performance reasons? e.g. say I need to order by a datetime field allot, I may put a index on that column. ...

NHibernate Cacheing Issue

Hi, I've got a Service I'm attempting to move over to NHibernate. Theres a Get method on the service that is called via a cancel button on the view. The first time the Get method is called (the first time I cancel a change) the cancel actually happens and the value returns. The second time I cancel, it just ignores the cancel and kee...

How can i force Nhibernate transaction to fail ?

How can i force Nhibernate transaction to fail(from the calling code) so i can make sure that the failing behavior is working properly? I can't modify the source code i just need to make it fail! example : public void DoSomething(/*Some parameters*/){ using (var tx = _session.BeginTransaction()) { try { //Do something...

Why is am I getting a duplicate class mapping error

in my nhibernate session helper class, I load my entities into the configuration like: static NHibernateHelper() { try { Configuration cfg = new Configuration(); cfg.Configure(); cfg.AddAssembly(typeof (Category).Assembly); ...

NHibernate not throwing StaleObjectStateException when <Version> used and data changed in database

I have an entity mapped in NHibernate with optimistic concurrency control using a SQL timestamp column as the version number. The mapping is like the following: <class name="Entity" optimistic-lock="version" discriminator-value="0"> <id name="id"> <generator class="native" /> </id> <version name="Version" column="Ver...

Unit of work in multiple threads

I just implemented the async pattern in a wcf service, when i received the error message: You are not in a unit of work. I knew I had this message before but didn't know exactly what I did back then. So I did some experimenting and just called the UnitOfWork.Start(). This solved the issue. However now I am wondering..is this a good solut...

Nhibernate date comparison

Here's the problem I'm trying to solve. I want to pass a date, then retrieve all itemorders that were picked on that date using NHibernate. When I pass a orderPickDate to the method below, it never comes back with a result. I don't want to pass a date range, I just want to pass a single date, ignore the time, and if any itemOrders exist...

Linq.NHibernate problem with OR statement

NOTE: all the code is written Top of my head. It can contains some mistakes. Just get the overall point of this question) Taking this class definition: (reduced for simplicity) public class CodedValue { public string Code { get; set; } public string Value {get; set; } } Taking thoses objects: CodedValue cv1 = new CodedValue(){ C...

NHibernate extract DBTransaction from Session

Hi there, I have an legacy db where some stored proc calculates the row ids for all the tables. Now I want to overwrite the IIdentifierGenerator as hinted at this page http://www.richter-web.info/Wordpress/?p=132 just to avoid the Id(x => x.id).GenereatedBy.Assigned. Now as I save some object,of course inside an Nhibernate transaction,...

If I use nhibernate to map tables 1:1 with no associates, do I still need dynamic proxy etc?

If I just want to keep things very simple, and just map my tables to POCO 1:1 with no collections on the entities e.g. instead of doing : class Order class OrderItems where you have: Order o = new Order(); o.Items <-- collection of OrderItems that will query the db using lazy loading I just have to do this manually: Order o = myD...

Mocking an NHibernate ISession with Moq

Hello, I am starting a new project with NHibernate, ASP.NET MVC 2.0 and StructureMap and using NUnit and Moq for testing. For each of my controllers I have a single public constructor into which an ISession is being injected. The application itself works just fine, but in terms of unit testing I essentially have to mock an ISession in or...

Why do I need nhibernate.dll referenced in my asp.net mvc project?

All my data logic is in another data layer project that I reference in my asp.net mvc project. Now if I call: CategoryDAO.GetById(1); Everything works fine. If I call: CategoryDAO.GetBlah(1); VS.NET complains saying "Error 102: The type 'NHibernate.Criterion.Order' is defined in an assembly that is not referenced. You must a...

Where is the SQL outputting when setting show_sql in NHibernate?

Where is the SQL outputting when setting show_sql in NHibernate? I have ReSharper as well. ...

Don't need lazyloading, do I still need a proxy?

with nhibernate, I don't need any lazy-loading functionality. Do I still need to add a proxy in my config? <property name="proxyfactory.factory_class">????</property> In the nhibernate download, they have a /requiredBins/ folder, and another folder /required_lazyloading Since I don't want lazyloading, do I still need it? w/o it, I ...

Fluent NHibernate Automapper maps Enum to nvarchar(255) and not int?

Why are enums mapped as strings and not as ints when using automapper in Fluent NHibernate? ...

help building castle dynamic proxy

So I pulled the source from https://svn.castleproject.org/svn/castle/DynamicProxy/trunk/ Open it up in vs.net 2008 problems: vs.net can't open the assembly.cs assembly signing failed What am I doing, rather NOT doing? Update So I downloaded nant, setup the .bat file in my PATH so it works in cmd prompt. I ran: nant default.buil...

Informix with NHibernate

Hi All, I am trying to get Informix working with NHibernate on windows 7. I have a connection string that works fine with informix now, it is this, Database=db;Server=server:port;uid=username;password=password;pooling=false I am using the IBM.Data.Informix .NET provider version 9.0.0.2. We have a number of different applications that...

Nhibernate component with mapped class problem

I am working with oracle and nhibernate. I can select list of an object from db table (all items in table) as Iquerable, but when I try to select an item from the list using "linq where clause" it sends nonsense query to oracle db. And it gets invalid identifier error. I can get whole list without any error in query, it happens when I u...