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
0
votes
1 answer

Can I get LINQ to NHibernate for 2.1.2GA

I'm using NHibernate 2.1.2 GA. We want to use LINQ for NHibernate with it, so I downloaded LINQ for NHibernate 1.0 (the one linked to in the first paragraph of Ayende's blog…
LondonPhantom
  • 1,867
  • 3
  • 19
  • 26
0
votes
2 answers

searching using fluent nHibernate using LINQ where property may reside in numerious locations in derived classes

I have a class structure as follows (pseudo code): CompanyName (id, name) // Other information about the company IUsefulSearchField // A field that can appear at any depth in the below IUsefulSearchField2 // A field that can appear at any depth…
David E
  • 415
  • 4
  • 11
0
votes
1 answer

Query by type using Linq on an nHibernate table by sub-class structure

I have quite a complex entity structure where several classes inherit from a base class, hence choosing a table per-subclass structure in nhibernate. BaseProject ProjectA : BaseProject ProjectB : BaseProject ProjectC : BaseProject ProjectD :…
big_tommy_7bb
  • 1,257
  • 2
  • 21
  • 37
0
votes
2 answers

LINQ to NHibernate: selecting entity which has a specific entity in a one to many association

I would like to make this query: Session.Linq().Where(u => u.Payments.Count(p => p.Date != null) > 0); In plain English I want to get all the users that has at least one payment with the date specified. When I run the sample code I get a…
knut
  • 4,699
  • 4
  • 33
  • 43
0
votes
1 answer

Querying with linq a collection mapped as a map (IDictionary)

Using NHibernate, I have a collection of entities mapped as a dictionary. By example, class A has a collection of B named Children, mapped as a IDictionary. B has a property Name. Querying class A base on some condition on B children…
Frédéric
  • 9,364
  • 3
  • 62
  • 112
0
votes
1 answer

Does anyone know why Take() isn't working here

i have the following code using Nhibernate.Linq var apps = Session.Linq().OrderByDescending(r => r.LastUpdated).Take(50); Console.Write(apps.Count()); the count returns 1000 (NOT 50 which is what i would have expected) any ideas why…
leora
  • 188,729
  • 360
  • 878
  • 1,366
0
votes
1 answer

Nhibernate createsqlquery from different db won't persist

I first try and pull the customer from the db, but if my customer doesn't exist, then i make a sql call another db on the server to get the information. I'd like to then save the customer info in my db. The Session is currently hooked up to my…
Mike
  • 217
  • 4
  • 16
0
votes
1 answer

NHibernate - "In" query with composite id

I'm trying to perform an "in" query on a collection of id objects (implemented as a simple class with two integer id members) which are mapped as composite-keys and I'm seeing some strange results when I query using the criteria api using…
DanP
  • 6,310
  • 4
  • 40
  • 68
0
votes
1 answer

LINQ-to-NHibernate Filter IQueryable by Composite Field - "Could not resolve property" error

Quick background - I have a form that offers a handful of optional options to users and a search method on my service that accepts all those fields and attaches the necessary Where() conditions on the master IQueryable list. One of those filters…
Danny Douglass
  • 390
  • 1
  • 11
0
votes
1 answer

Linq for NHibernate strange Count() behavior

I have what strikes me as a very unusual behavior from Linq for NHibernate. In general, all my entity classes are working just fine, but one of them throws a "NonUniqueResult" exception from the NHibernate namespace under the following condition. …
Dr. Evil
  • 61
  • 3
0
votes
1 answer

NH4 LINQ Query using wrong column for one-to-one

I have one-to-one relationship between two tables, and I want to be able to create a LINQ query that will return the "parent" tables where there is something in the child table. The problem is that the query NH is generating is checking to see if…
Becca Dee
  • 1,530
  • 1
  • 24
  • 51
0
votes
1 answer

Nhibernate Linq Error on Single or Default

I'm pulling my hair out over here and I'm not sure what's causing it. I have the following LINQ query: return Session.Linq().SingleOrDefault(p => p.UserName.ToLower().Equals(userName.ToLower())); and its throwing the…
Chance
  • 11,043
  • 8
  • 61
  • 84
0
votes
1 answer

Query over many-to-many entity with nhibernate

I kinda need a brainstorm here.. Here's my scenario: public class UserSystem { public virtual User User { get; set; } public virtual System System { get; set; } } public class User { public User() { } public virtual int UsrId { get;…
0
votes
2 answers

Fluent NHibernate: Mapping a column with a different name

Let's say I have a table: Project Id Title ProjectManagerId ContactId ProjectManagerId and ContactId are both id's from a table named Person: Person PersonId Firstname Lastname How can I map these two columns to create a person object? (either…
Allov
  • 1,308
  • 1
  • 13
  • 23
0
votes
1 answer

Many-To-Many Query with Linq-To-NHibernate

Ok guys (and gals), this one has been driving me nuts all night and I'm turning to your collective wisdom for help. I'm using Fluent Nhibernate and Linq-To-NHibernate as my data access story and I have the following simplified DB structure: CREATE…