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

NHibernate.Linq -> The method CompareTo is not implemented

Here's the problem: in short I use comb.guid identity strategy and I need all the rows made after the saved marker.. Here's dummy code example of what I am trying to get: return session.Linq .Where(p =>…
Nikola Malovic
  • 1,230
  • 1
  • 13
  • 24
5
votes
1 answer

Linq to NHibernate wrapper issue using where statement

I'am using wrapper to get some data from table User IQueryable WhereQuery = session.Linq().Where(u => u.HomeClub.Id == clubId && u.IsActive).Select( u => new StarGuestWrapper() …
Jacob
  • 914
  • 2
  • 10
  • 30
5
votes
1 answer

Nhibernate query for items that have a Dictionary Property containing value

I need a way to query in Nhibernate for items that have a Dictionary Property containing value. Assume: public class Item { public virtual IDictionary DictionaryProperty {get; set;} } and mapping: public ItemMap() { …
5
votes
4 answers

LINQ-NHibernate - Selecting only a few fields (including a Collection) for a complex object

I'm using Fluent NHibernate in one of my projects (and ASP.NET MVC application), with LINQ to query to data (using the LINQ to NHibernate libraries). The objet names are changed to protect the innocent. Let's say I have the following classes Foo,…
Guillaume Gervais
  • 1,035
  • 2
  • 14
  • 26
5
votes
1 answer

NHibernate: How do I ignore the cache and go directly to the database?

Consider a typical NHibernate context class. public class SampleContext : NHibernateContext { public SampleContext(ISession session) : base(session) { } public IQueryable People { get { return…
Jim G.
  • 15,141
  • 22
  • 103
  • 166
5
votes
2 answers

NHibernate.Linq LockMode

Is it possible to set the LockMode when using NHibernate.Linq? When using ICriteria I can this way: var criteria = Session.CreateCriteria(); criteria.SetLockMode(LockMode.None); criteria.Add(Expression.Eq("Title", title)); Is it possible to…
mxmissile
  • 11,464
  • 3
  • 53
  • 79
5
votes
1 answer

Eager loading child and child-of-child collections in NHibernate

I've got a problem with NHibernate trying to load a small hierarchy of data. My domain model looks like: class GrandParent { int ID{get;set;} IList Parents {get; set;} } class Parent { IList Children {get; set;} } class…
Simon
  • 5,373
  • 1
  • 34
  • 46
5
votes
1 answer

NotSupportedException with linq query and groupBy

I get a "NotSupportedException" when running this Linq query. "Specified method is not supported." What method? Even with "Count()" commented out, the error is the same. Null Inner Exception. Stack Trace: at…
Seraph812
  • 397
  • 3
  • 7
  • 17
4
votes
1 answer

Is LINQ to NHibernate susceptible to SQL injection and other security risk afflicting raw sql

I did web searches but I could not find solid answers. Is LINQ to NHibernate susceptible to SQL injection and other raw SQL attacks? If yes, what are same codes illustrating how to avoid such database attacks?
Phil
  • 2,143
  • 19
  • 44
4
votes
1 answer

In Linq-to-Nhibernate, has anyone managed to use .Contains in a where clause and also NHibernate.Linq.ToFuture() in the same query? (NH 3.x)

I always get a "System.Collections.Generic.KeyNotFoundException" that says "The given key was not present in the dictionary" whenever I try to use .Contains and the ToFuture() method in one query. Imagine the DBObject contains a bunch of properties…
Isaac Bolinger
  • 7,328
  • 11
  • 52
  • 90
4
votes
2 answers

NHibernate Linq and DistinctRootEntity

When I execute the following query, I get an exception telling me that 'feedItemQuery' contains multiple items (so SingleOrDefault doesn't work). This is expected behaviour when using the Criteria api WITHOUT the DistinctRootEntity transformer, but…
Remco Ros
  • 1,467
  • 15
  • 31
4
votes
1 answer

Is there a way to prevent boolean performance problems with NHibernate LINQ provider

We were using NHibernate 2.1 and I upgraded our system to 3.0 to test the new LINQ provider. I compared the linq provider, createquery, and queryover. Createquery and queryover did pretty much the same thing, same performance. However the LINQ…
BradLaney
  • 2,384
  • 1
  • 19
  • 28
4
votes
3 answers

NHibernate projecting child entities into parent properties with Linq or QueryOver

Maybe it's simple but I'm stuck with it and I didn't find any answer on how it could be done. I have a parent entity User with a collection of child entities Operations. These two entities are just for UI so they are a kinf of views. Here is the…
4
votes
2 answers

Good behaviour for eager loading multiple siblings and grandchildren (cousins?) in NHibernate 3.0 Linq

I'm trying to do the following with NHibernate 3.0's LINQ interface. I want to query for an object (using some Where clause), and load some children and grandchildren. Currently I'm doing it like so: var results = session.Query() …
sinelaw
  • 16,205
  • 3
  • 49
  • 80
4
votes
1 answer

Linq to nhibernate - Where collection contains object with id

I have 2 objects like this public class Child { public virtual int ChildId { get; set; } } public class Parent { public virtual int ParentId { get; set; } public virtual IList Children { get; set; } } I am trying to write a…
Josh
  • 16,286
  • 25
  • 113
  • 158