Questions tagged [nhibernate]

NHibernate is an open source object-relational mapper (ORM) for the .NET framework.

NHibernate is an open source object-relational mapper (ORM) for the .NET framework.

It started as a .NET port of the popular Java ORM Hibernate.

Installation

Installing NHibernate can most easily be done using its NuGet package:

Install-Package NHibernate 

Resources

17517 questions
5
votes
2 answers

nHibernate 3.2 database config in code?

NHibernate seems to have some new ways to map entities in code, which is really nice, but I can't find any information about configuring the database connections in code. It has been a while since I used NHibernate (version 2) and I am used to…
A.R.
  • 15,405
  • 19
  • 77
  • 123
5
votes
5 answers

How to deserialize Enumerable.ToList<>() to List<>

I'm trying to build an object that looks something like this: public class MyObject { private IList items; public List Items { return items.AsEnumerable().ToList(); } } I'm…
5
votes
1 answer

how to map ordered list in nhibernate?

I have two classes: container which contains dynamic ordered list of Element. What C# collection should I use? What DB schema would you suggest me? How should I configure the nhibernate mapping? TIA
Elad Benda
  • 35,076
  • 87
  • 265
  • 471
5
votes
2 answers

NHibernate, one-to-one mapping, cascade insert

I have a one-to-one relationship between a Company class and a CompanySettings class. When I create a new Company object, (a CompanySettings object is created in Company's constructor for its Settings property), and then SaveOrUpdate(session,…
Andrew Gibson
5
votes
2 answers

Integration Testing Chained WCF Services with Test Database

Looking for some advice on how to proceed here. I am trying to do some integration testing on wcf services that call other wcf services. I want to make sure that they are configured correctly between one another. We are currently using spring.net…
Aaron M
  • 2,523
  • 1
  • 23
  • 38
5
votes
1 answer

NHibernate: proxies cannot be fetched by a stateless session error message

I'm using an nHibernate stateless session to fetch an object, update one property and save the object back to the database. I keep getting the error message: proxies cannot be fetched by a stateless session I have similar code working elsewhere,…
Matt
  • 322
  • 6
  • 12
5
votes
3 answers

NHibernate.AssertionFailure: null identifier

Before I kick my computer in to next week... I've checked out every other question about this, but none of them have the solution. I've stripped this code right back, but it's still not working. I'm getting this error when saving an object:…
Paul
  • 9,409
  • 13
  • 64
  • 113
5
votes
2 answers

NHibernate - multiple JOIN to the same table by different keys

Another NHibernate JOIN problem. I'm trying to join two different properties from one table by different two keys. But I can't get the second JOIN property. Simplified example - My class - namespace Domain { public class Message { …
Mr Mush
  • 1,538
  • 3
  • 25
  • 38
5
votes
1 answer

Linq to NHibernate query comparing enum mapped as integer succeeds, but fails as equivalent criteria query

I'm querying for ProductRisk, which contains a Status property, where Status is an enum. Here's the mapping for ProductRisk: public class ProductRiskMap : ClassMap { public ProductRiskMap() { …
Vish
  • 453
  • 6
  • 18
5
votes
1 answer

NHibernate + SqlServer full text search

I have to do Full text search in NHibernate For following operation previously I am using Lucene.Net I have a table called candidate For full text query Lucene will return all candidate Id from lucene index and form that id I put in query in…
Anand
  • 717
  • 6
  • 20
5
votes
5 answers

What happens if 2 or more people update a record at the exact same time?

I'm using NHibernate with the version property that automatically increments every time my aggregate root is updated. What happens if 2 or more people update the same record at the exact same time? Also, how would I test this? Note that this isn't a…
gcso
  • 2,315
  • 3
  • 28
  • 50
5
votes
1 answer

Avoid specifying key column in double linked scenario

Assume I have the following two classes: public class User : Entity { public virtual IList Items { get; set; } } public class Item : Entity { public virtual User Owner { get; set; } } I created two mapping classes: public class…
Daniel Hilgarth
  • 171,043
  • 40
  • 335
  • 443
5
votes
2 answers

could not resolve property: User.Full_Name of: Harrods.Core.Entities.Teacher

I have this ASP.NET MVC3 code that's powered by Spring and Fluent NHibernate (NHIB 3.1) I have this error: could not resolve property: User.Full_Name of: Harrods.Core.Entities.Teacher [QueryException: could not resolve property: User.Full_Name of:…
RicL
  • 533
  • 2
  • 6
  • 24
5
votes
1 answer

NHibernate Criteria QueryByExample stuck with SQL in the middle

I am using Criteria to speed up a query, and I am almost there. Using Query By Example to match up rows in a table, remove duplicate rows with the same id, and then paginate. Of course I can't paginate until I remove the duplicate rows, and I don't…
5
votes
2 answers

NHibernate QueryOver Multiple Order By with Aliases

This is my scenario: public IEnumerable getSuperMercTree(string IDLanguage) { SuperMercModel SMer = null; SuperMercDescriptionModel descrSMer = null; MercModel Merc = null; MercDescriptionModel descrMerc =…
Faber
  • 2,194
  • 2
  • 27
  • 36