Questions tagged [linq-to-nhibernate]

A provider for NHibernate library for .NET Framework which allows to use LINQ queries. Available since version 3.0.

629 questions
9
votes
4 answers

'string' does not contain a definition for 'Contains'

I have a statement like so: var vals = from StandAloneUserPayment saup in _Session.Query() .Fetch(x => x.RecurringPayments) where saup.User.UserId == userId &&…
Jeremy Holovacs
  • 22,480
  • 33
  • 117
  • 254
9
votes
2 answers

Max in linq to NHibernate for not exist data in database

I have a query by linq to NHibernate. var q = SessionInstance.Query().Max(e => e.Code); If Request table has no rows, execution of this query raises GenericADOException with this message : {"Could not execute query[SQL: SQL not…
Ehsan
  • 3,431
  • 8
  • 50
  • 70
8
votes
2 answers

NHibernate (3.1.0.4000) NullReferenceException using Query<> and NHibernate Facility

I have a problem with NHibernate, I can't seem to find any solution for. In my project I have a simple entity (Batch), but whenever I try and run the following test, I get an exception. I've triede a couple of different ways to perform a similar…
8
votes
1 answer

Statistical query in SQL - is this possible with NHibernate LINQ?

I have an application that uses a few data warehousing principles such as dimensional modeling to do reporting on a fairly simple database. An example (simplified) entity named Call looks like this: public virtual long Id { get; set; } …
Rune Jacobsen
  • 9,907
  • 11
  • 58
  • 75
8
votes
1 answer

NHibernate: can't successfully eager load

I'm using NH 3.0 and FNH 1.1 recompiled with NH3. I have a user model where I want to always retrieve its profile when loading it. I use the linq provider from NH3 but can't use its Fetch method (because of my repository that hides NHibernate and…
Nicolas Cadilhac
  • 4,680
  • 5
  • 41
  • 62
8
votes
2 answers

Eager load while using Linq in NHibernate 3

I need help with eager loading in with Linq in NHibernate 3 trunk version. I have a many-to-many relationship like this: public class Post { public int Id {get;set;} public IList Tags { get;set;} . . . } Now I have the…
madaboutcode
  • 2,137
  • 1
  • 16
  • 23
8
votes
3 answers

Unexpected Linq Behavior - ToList()

I have two similar queries theoretically returning the same results: var requestNotWorking = SessionManagement.Db.Linq(false).Where(i => i.Group != null && i.Group.Id == methodParameter) …
Keysharpener
  • 486
  • 3
  • 14
7
votes
3 answers

NHibernate is producing SQL with a bad join

I have an NHibernate Linq query which isn't working how I would expect. The problem seems to come from using a nullable int column from a left joined table in the where clause. This is causing the join to act like an inner join. var list =…
7
votes
2 answers

NHibernate 3, Dynamic-Component, Dictionaries, and LINQ Queries

I've got this entity with a entry and a number of properties on it. It's being consumed on the entity class as an IDictionary. The mapping works fine and everything is hunky dory until I go to query based on values in this…
Aren
  • 54,668
  • 9
  • 68
  • 101
7
votes
2 answers

How to use nhibernate ToFuture query with nhibernte linq

Does ToFuture works with nhibernate linq? If so, how do you use it?
ryudice
  • 36,476
  • 32
  • 115
  • 163
7
votes
4 answers

Does it make sense to use an OR-Mapper?

Does it make sense to use an OR-mapper? I am putting this question of there on stack overflow because this is the best place I know of to find smart developers willing to give their assistance and opinions. My reasoning is as follows: 1.) Where does…
RBZ
  • 2,034
  • 17
  • 34
7
votes
1 answer

How do you deal with Linq to NHibernate's Fetch exception when selecting aggregates?

I'm using LINQ to NHibernate's IQueryable implementation on a asp.net mvc Grid (telerik specifically), where I know I'll need to fetch something eagerly for this particular grid. So I have query that looks something like this: var query = from s in…
Joseph
  • 25,330
  • 8
  • 76
  • 125
7
votes
1 answer

Linq to NHibernate ThenFetch multiple properties

I've got this object graph: // Lots of stuff omitted for brevity; these are all virtual properties and there // are other properties which aren't shown on all classes. class A { B b; C c; DateTime timestamp; } class B { X x; Y…
configurator
  • 40,828
  • 14
  • 81
  • 115
7
votes
1 answer

NHibernate Linq - how to create a where statement with IS NOT NULL

how can i achieve this query with Nhibernate Linq? var l = session.CreateQuery("from Auswahl a where a.Returnkey is not null").List(); i tried this but it always returns an empty list. var l = session.Linq() …
blindmeis
  • 22,175
  • 7
  • 55
  • 74
7
votes
3 answers

Nhibernate .Fetch calls fail on a mocked session

I love NHibernate (and NHibernate.Linq). I don't prematurely optimize, but sometimes I'll hit a really nasty N+1 issue. The recommended fix for the N+1 is to use NH's Fetch extension method. The problem arises when I create a Mock of the ISession.…
viggity
  • 15,039
  • 7
  • 88
  • 96
1 2
3
41 42