nhibernate

ServiceLocator has not been initialized; I was trying to retrieve SharpArch.Core.CommonValidator.IValidator

Server Error in '/' Application. ServiceLocator has not been initialized; I was trying to retrieve SharpArch.Core.CommonValidator.IValidator Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code...

Conditional NHibernate Named Query Mapping by Dialect

How might I use a stored procedure from NHibernate but at the same time keep the solution database-agnostic and the codebase clean of switch statements with a case for each Dialect? I expect to create a Named Query per database implementation containing the content of the database-specific sql implementation of the procedure. My dile...

Arguments for moving from LINQtoSQL to Nhibernate?

Backstory: Hi all, I just spent a lot of time reading many of the LINQ vs Nhibernate threads here and on other sites. I work in a small development team of 4 people and we don't even have really any super experienced developers. We work for a small company that has a lot of technical needs but not enough developers to implement them (and...

NHibernate: why ILifecycle.OnUpdate is not called every time ?

NHibernate_reference.pdf, page 26: Note that ILifecycle.OnUpdate() is not called every time the object's persistent state is updated. It is called only when a transient object is passed to ISession.Update(). Why it design link that? ...

Fluent nHibernate and mapping IDictionary<DaysOfWeek,IDictionay<int, decimal>> how to?

Hello, I have problem with making mapping of classes with propert of type Dictionary and value in it of type Dictionary too, like this: public class Class1 { public virtual int Id { get; set; } public virtual IDictionary<DayOfWeek, IDictionary<int, decimal>> Class1Dictionary { get; set; } } My mapping looks like this: ...

FluentNhibernate dynamic runtime mappings.

I am building a framework where people will be able to save items that the created by inheriting a class of mine. I will be iterating over every type in the appdomain to find classes that I want to map to nhibernate. Every class that I find will be a subclass of the inherited type. I know how to create sub types in FluentNhibernate, but...

FluentNHibernate mapping of composite foreign keys

I have an existing database schema and wish to replace the custom data access code with Fluent.NHibernate. The database schema cannot be changed since it already exists in a shipping product. And it is preferable if the domain objects did not change or only changed minimally. I am having trouble mapping one unusual schema construct illu...

(Fluent) NHibernate Security Exception - ReflectionPermission

I've upgraded an ASP.Net Web application to the latest build of Fluent NHibernate (1.0.0.636) and the newest version of NHibernate (v2.1.2.4000). I've checked a couple of times that the application is running in Full trust. But I keep getting the following error: Security Exception Description: The application attempted to perform an op...

Generating db schema from c# class

Hi, Is there any other method than nHibernate by wich we can generate db schema from class definition? My classes arn't that complex etc (few one-to-many relations). However I would like to just be able to save my objects in db and recreate schema if needed. I am stuck with .NET 2.0. I am not that particular about performance for this p...

ORM market analysis

I would like to see your experience with popular ORM tools outhere, like NHibernate, LLBLGen, EF, S2Q, Genom-e, LightSpeed, DataObjects.NET, OpenAccess, ... From my exp: - Genom-e is quiet capable of Linq & performance, dev support - EF lacks on some key features like lazy loading, Poco support, pers.ignorance... but in 4.o it may ha...

nHibernate query looking for the related object's related object

I have an nHibernate querie issue that looks quite straight forward, but I can't seem to get my head around it! I am creating some simple example classes to illustrate my problem: public class Car { public int Id { get; set; } public IList<Interior> InteriorParts { get; set; } } public class Interior { public int Id { get;...

Linq to NHibernate wrapper issue using where statement

I'am using wrapper to get some data from table User IQueryable<StarGuestWrapper> WhereQuery = session.Linq<User>().Where(u => u.HomeClub.Id == clubId && u.IsActive).Select( u => new StarGuestWrapper() { FullName = u.Name + " " + u.LastName, ...

NHibernate Projections to retrieve a Collection?

I´m having some trouble retrieving a collection of strings in a projection: say that I have the following classes public class WorkSet { public Guid Id { get; set; } public string Title { get; set; } public ISet<string> PartTitles { get; protected set; } } public class Work { public Guid Id { get; set; } public WorkS...

NHibernate 2.1 MsSql2000Dialect error

Hi. I had an old (but great) app using NHibernate 1.0.2. Worked like a charm. But then I decided to upgrade to NHibernate 2.1.2. Had to change some stuff, worked great also. Problem is, I founded out that new version works in some machines and do not work in others. What the heck? Thinking a while, I discovered that it only works in p...

nHibernate Domain Model and Mapping Files in Separate Projects

Is there a way to separate out the domain objects and mapping files into two separate projects? I would like to create one project called MyCompany.MyProduct.Core that contains my domain model, and another project that is called MyCompany.MYProduct.Data.Oracle that contains my Oracle data mappings. However, when I try to unit test this...

In NHibernate, how do I combine two DetachedCriteria instances

My scenario is this: I have a base NHibernate query to run of the form (I've coded it using DetachedCriteria , but describe it here using SQL syntax): SELECT * FROM Items I INNER JOIN SubItems S on S.FK = I.Key The user interface to show the results of this join allows the user to specify additional criteria: Say: I.SomeField = 'Use...

Parameter index is out of range

Hello, I am getting the following error when trying to update an object using nhibernate. I am attempting to update a field which is a foreign key. Any thoughts why I might be getting this error? I can't figure it out from that error and my log4net log doesn't give any hints either. Thanks System.IndexOutOfRangeException was unhand...

ERROR NHibernate.Event.Default.AbstractFlushingEventListener Could not synchronize database state with session

I am using NHibernate with SQLServer 2005,.net 3.5 & WCF Service. I am getting the following error this error intermittently when trying to delete record from database. ERROR NHibernate.Event.Default.AbstractFlushingEventListener - Could not synchronize database state with session NHibernate.Exceptions.GenericADOException: could not de...

Exception "The operation is not valid for the state of the transaction" using TransactionScope

We have a web service on server #1 and a database on server #2. Web service uses transaction scope to produce distributed transaction. Everything is correct. And we have another database on server #3. We had some problems with this server and we reinstalled operation system and software. We configured MSDTC and tried to use web service ...

How do I get NHibernate to work with .NET Framework 2.0?

I can not make NHibernate 2.1 work in machines without framework 3.X (basically, windows 2000 SP4, although it happens with XP too). NHibernate doc do not mention this. Maybe you can help? I NEED to make NHibernate 2.1 work in Windows 2000 PCs, do you think this can be done? PD: DataBase is SQL 2000/2005. Error is: NHibernate.Mapping...