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
34
votes
9 answers

Problem using SQLite :memory: with NHibernate

I use NHibernate for my dataacess, and for awhile not I've been using SQLite for local integration tests. I've been using a file, but I thought I would out the :memory: option. When I fire up any of the integration tests, the database seems to be…
Chris Canal
  • 4,824
  • 9
  • 35
  • 45
34
votes
7 answers

ADO.NET Entity Framework vs NHibernate

So the ADO.NET Entity Framework has gotten a little bit of bad press (in the form of blog entries and a petition) but I don't want to rush to judgement. I'm limited in time for experimentation but I was wondering has anyone worked with it yet with…
t3rse
  • 10,024
  • 11
  • 57
  • 84
33
votes
6 answers

How to Command Query Responsibility Segregation (CQRS) with ASP.NET MVC?

I have been reading about Command Query Responsibility Segregation (CQRS). I sort of wonder how would this work with ASP.NET MVC? I get the idea of CQRS conceptually it sounds nice and sure does introduce some complexities (event and messaging…
Jeff
  • 13,079
  • 23
  • 71
  • 102
33
votes
5 answers

CQRS - The query side

A lot of the blogsphere articles related to CQRS (command query repsonsibility) seperation seem to imply that all screens/viewmodels are flat. e.g. Name, Age, Location Of Birth etc.. and thus the suggestion that implementation wise we stick them…
user53791
33
votes
2 answers

Best way to store enum values in database - String or Int

I have a number of enums in my application which are used as property type in some classes. What is the best way to store these values in database, as String or Int? FYI, I will also be mapping these attribute types using fluent Nhibernate. Sample…
inutan
  • 10,558
  • 27
  • 84
  • 126
33
votes
3 answers

How can C# nullable value typed values be set on NHibernate named IQuery parameters?

I am using NHibernate and calling a stored procedure via a named query: EXEC [SearchStuff] ?, ?, ? Many of the stored procedure…
Daniel Renshaw
  • 33,729
  • 8
  • 75
  • 94
32
votes
3 answers

Fluent NHibernate, working with interfaces

I just switched to Fluent NHibernate and I've encountered an issue and did not find any information about it. Here's the case : public class Field : DomainObject, IField { public Field() { } public virtual string Name { get; set;…
Charles Ouellet
  • 6,338
  • 3
  • 41
  • 57
32
votes
5 answers

Install NHibernate 3.2 with NuGet

I'm new to NHibernate and have been trying to get up and running with it, Fluent NHibernate and NHProf using NuGet. After reading this article (http://gurustop.net/blog/2011/03/13/nhibernate-3-1-0-on-nuget-important-details) it seems that v3.1…
RuairiQ
  • 431
  • 1
  • 5
  • 9
32
votes
4 answers

Fighting cartesian product (x-join) when using NHibernate 3.0.0

I'm bad at math but I kind get idea what cartesian product is. Here is my situation (simplified): public class Project{ public IList Partners{get;set;} } public class Partner{ public IList Costs{get;set;} public…
Arnis Lapsa
  • 45,880
  • 29
  • 115
  • 195
32
votes
5 answers

NHibernate 3.0: No FirstOrDefault() with QueryOver?

I am playing with FluentNHibernate and NH 3.0, using the LINQ provider and the new QueryOver syntax. Now with QueryOver I want to get an item (called result) with a timestamp value as close as possible to a given value, but not greater: Result…
Marcel
  • 15,039
  • 20
  • 92
  • 150
32
votes
9 answers

JSON.NET and nHibernate Lazy Loading of Collections

Is anybody using JSON.NET with nHibernate? I notice that I am getting errors when I try to load a class with child collections.
user32326
  • 437
  • 1
  • 6
  • 6
32
votes
5 answers

NHibernate Transactions on Reads

I have read the documentation and explanation on why it is highly recommended to use transactions on read operations in NH. However, I still haven't totally "bought" into it yet. Can someone take a stab at explaining it without just telling me to…
Bob
  • 483
  • 5
  • 6
32
votes
3 answers

Difference between FluentNHibernate and NHibernate's "Mapping by Code"

I am coming from an Entity Framework and LLBL background for my ORM tools. I have been asked to build a new system based on NHibernate. I have never done so, so I am coming at it with fresh eyes. What is the difference between mapping with Fluent…
31
votes
2 answers

What is the difference between StatelessSession and Session in NHibernate?

What is the difference between StatelessSession and Session in NHibernate?
masoud ramezani
  • 22,228
  • 29
  • 98
  • 151
31
votes
6 answers

How do I call a stored procedure from NHibernate that has no result?

I have a stored procedure that logs some data, how can I call this with NHibernate? So far I have: ISession session = .... IQuery query = session.CreateQuery("exec LogData @Time=:time @Data=:data"); query.SetDateTime("time",…
thatismatt
  • 9,832
  • 10
  • 42
  • 54