fluent-nhibernate

Fluent NHibernate table-per-class-hierarchy need to use .Where() ?

I have the following mapping for a set of contact classes based off an abstract Contact class implementation. public class ContactMapping : ClassMap<Contact> { public ContactMapping() { Id(x => x.Id).GeneratedBy.GuidComb(); Map(x => x.CreatedDate).Not.Nullable(); Map(x => x.Value).Not.Nulla...

Is there a Fluent NHibernate Automapping sample project that "just works"?

I just started looking a NHibernate this week, and would love to use the Automapping approach on my current project. I'm working with Fluent NHibernate 1.0.0.594, which I downloaded a few days ago. I found the Examples.FirstProject in the NHibernate source code, which uses the older style entity mapping. This has been tremendously val...

HasMany<MySubtype> mapping returns supertype and all descendants?

Hi, I'm having a problem getting FluentNHibernate's HasMany<> mapping to behave as I would expect. I have a class hierarchy of Child is a descendant of Parent, defined using table-per-hierarchy, discriminated by the class name in a column named 'TYPE'. An unrelated class Group contains a collection of Child elements. So, the Group cl...

fluent nHibernate and relation to Asp.net Membership tables

I'm using fluent nHibernate (automapper) and at the same time use Asp.net Membership, but how do i reference aspnet_Users table? maybe create a new user table with only the ProviderUserKey as field? and always make references to that table? and use Membership.GetUser(..) to get name etc. ...

nHibernate/Fluent - SQL Query Question

I am new to nHibernate. I understand how to use mapping using Fluent nHibernate. Now I would like to use a little more complex query. However I am not sure how I would map or even approach this. Here is what I would like to do in an sql query: SELET Zone, CountOfStyles = (Select Count(1) from anotherTable Where StoreZoneId = zone.Z...

mixing NHibernate with 3 tier developing

I have a 3 tiered app: 1st layer: SQL DB. 2nd layer: App Sever (dotnet) 3rd layer: smart wpf client. I'm using NHibarnate (fluent) as the data source for the application server layer (App server- 2nd layer talks to DB using NH) Application layer talks to the client using WCF. Do I benefit anything from using NH - as WCF doesn't suppo...

Fluent NHibernate AutoMapping throws "StaleStateException" when try to Commit a List<>

The following code throws a StaleStateException exception when the Order.OrderItems property (an IList) is Commited. The full text of the exception is: An unhandled exception of type 'NHibernate.StaleStateException' occurred in NHibernate.dll Additional information: Unexpected row count: 0; expected: 1 I've just started using NHibern...

How do I use NHibernateMaps for foreign keys?

I have the following class: public class Element { public Guid Id { get; set; } public ElementRouting route { get; set; } } An Element can be routed to another element in a parent-child - like relationship represented by the following class: public class ElementRouting { public Guid Id { get; set; ...

Empty NHibernate log file with log4net

I'm trying to get logging enabled on my application using Fluent NHibernate and log4net. I have tried the things described here, here, here and here. The log file is getting created, but nothing is getting written to it. The other log files for this and other applications all seam to be working OK, so I'm assuming the issue is something ...

FluentNHibernate joined-subclass

What is the current method of implementing the joined-subclass structure with FluentNHibernate? By "current", I mean by not using deprecated methods such as JoinedSubClass or AddPart. Thanks! ...

Why is my NHibernate query failing with an IndexOutOfRangeException?

I am using Fluent NHibernate and in certain cases my query is failing with a System.IndexOutOfRangeException. It seems that the issue has to do with the combination of using escaped column name(s) in the mapping and calling CreateSQLQuery().AddEntity(). It works fine if none of the columns need escaping or if I instead use CreateCriteri...

How do you determine the recommended ADO.NET Batch Size in the Real World?

NOTE: I'm not looking for the answer from MSDN. How have you gone about determining the proper ADO.NET batch size value for your given database / application? What factors led to your decision and what experience can you share? Using Fluent NHibernate, I'm currently using something like: var sessionFactory = Fluently.Configure().Data...

WCF and FluentNHibernate

I've hit a wall on this one. I have a WCF library with a respective WCF web service. A sandbox web application attempts to fire one method from this service. The service, however, will log requests as they are made. The persistence layer here is built with FluentNHibernate. Session management in a web application has been pretty straigh...

NHibernate many-to-many delete causing foreign key violation

I'm having a problem with a pretty simple setup in NHibernate. (I'm using Fluent Nhibernate) I have two objects as follows, setup with a bi-directional many-to-many mapping. Project -- Categories (IList) Category -- Projects (IList) -- Inverse = True This models as expected in the db. If I try to delete a project NHibernate perfo...

What tools are available to auto-generate ASP.NET MVC REST services from domain objects?

I am developing an application for which I want to expose the basic CRUD operations on most of the database entities through REST web services. A colleague has demonstrated some impressive code generation using Grails. I would like to be able to generate my REST services as well, but using ASP.NET MVC instead of Grails. I planning on u...

Using NHibernate with ancient database with some "dynamic" tables

I have a legacy database with a pretty evil design that I need to write some applications for. I am not allowed to touch the database design at all, seeing how this is a fragile old system held together by spit and prayers. I am of course very aware that this is not how the database should have been designed in the first place, but real ...

Getting NHibernate to generate a HiLo string ID

Hi, We've got a large system that's loosely bound to its data source (Navision) via Unity - we're getting the opportunity to swap it out and have our own database. So we've had a look around and really like the look of Fluent NHibernate - we're trying to get a proof of concept going and swap out a couple of the services. We want to us...

Intercepting property setting in Fluent NHibernate

I'm new to Fluent NHibernate, and have what I think should be a simple question. The problem is that I can't seem to find a simple answer anywhere. I have a database column that is an nvarchar (SQL Server). It should map to a model property that is a System.Uri. The problem is that string doesn't implicitly convert to Uri. Is there ...

How to find out the revision number of fluent nhibernate's source code from where 1.0RTM was created.

Hi everyone, I'm currently building a new app and am stuck on the following 2 issues: 1)I wanted to check-out the tag/revision from the repo of fluent nhibernate from which 1.0RTM was created.But even after looking through the directory structure, I couldn't figure out which one was that.(Its pretty simple for NHibernate tho...

Why is my Fluent nHibernate repository (randomly) updating my domain entities?

We use the Fluent nHibernate repository model in a .net MVC project that I'm working on. While running a sql profile to check for areas of improvement we noticed that some objects were getting UPDATEd without an explicit Save. Does anybody know why nHibernate would choose to update an object when I select it? Class: public class Req...