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
4
votes
2 answers

Latest Binary builds of FLuentNhibernate + Nhibernate + Linq for NHibernate

do people build there own versions of all this? or is there a place to get all this prebuilt? I got the latest FluentNhibernate which has NHibernate but no Linq.... but I don't really want to setup a ruby rake build system etc etc unless I really…
Keith Nicholas
  • 43,549
  • 15
  • 93
  • 156
4
votes
4 answers

Where-clause for LINQ-to-NHibernate FetchMany?

Using LINQ-to-NHibernate is there a way to narrow down what FetchMany() returns? Given the following class structure public class Foo { public virtual int Id { get; set; } public virtual IList Bars { get; set; } } public class Bar { …
Sebastian Weber
  • 6,766
  • 2
  • 30
  • 49
4
votes
2 answers

NHibernate.QueryException: not an association: Id

I wrote a joint query using NHiberNate, but I am getting a NHibernate.QueryException:not an association: Id This is what it looks like with NHibernate library TicketRequest ticketAlias = null; Show showAlias = null; …
doglin
  • 1,651
  • 4
  • 28
  • 38
4
votes
1 answer

NHibernate LINQ : Why is a query using the incorrect char value if I repeat the call?

Using NHibernate 3.3.1.4000 / .Net 3.5 I have an object I'm mapping to an existing Oracle 10g database : public MyJob : LegacyOracleDbObjects { public virtual int JobID { get; protected set; } public virtual char Status { get; protected…
Craig.Nicol
  • 1,834
  • 2
  • 15
  • 20
4
votes
1 answer

How to handle NHibernate LINQ empty result set?

I want to retrieve list of roles for a logged in user. Following is a code segment that reads user roles from the database. ISession session = NHibernateHelper.GetCurrentSession(); var data = from s in…
AlterWorld
  • 429
  • 1
  • 6
  • 18
4
votes
2 answers

Group by date with LINQ to NHibernate

I am facing an issue with an unsupported feature in the LINQ implementation of NHibernate (it's firing a QueryException: "could not resolve property: CreatedOn.Date of: Example.Comment"). Given the entity below, I would like to extract statistics by…
Troels Thomsen
  • 11,361
  • 4
  • 28
  • 29
4
votes
1 answer

fluent nhibernate first level cache not working as expected

I have a function which gets called many times in one session. To my understanding with NHibernate first level cache, exact query in the same session will execute only once irrespective of the number of calls. Such is not the case though. Below is…
4
votes
1 answer

Unique results from joined queries with NHibernate LINQ provider

I'm using NHibernate 2.1 with the LINQ provider and the results I get back from this query have multiple root nodes: public IList GetAllCountries() { List results = (from country in _session.Linq() …
David P
  • 3,604
  • 3
  • 37
  • 54
4
votes
3 answers

How use Distinct in linq & linq to NHibernate by some columns

I have a Address class. public class Address : RootEntityBase { virtual public string Province { set; get; } virtual public string City { set; get; } virtual public string PostalCode { set; get; } } By this default values: var…
Ehsan
  • 3,431
  • 8
  • 50
  • 70
4
votes
4 answers

LINQ to NHibernate - compare guid with string

return queryable.Where(version => version.Id.ToString().Contains(searchKey)); This line will cause "ToString is not supported exception". The goal: create search query that will compare string, int, GUID with string keyword. Thanks for any help.
Ievgen Martynov
  • 7,870
  • 8
  • 36
  • 52
4
votes
3 answers

Get element page number

I have 10,000 items in a table that displays 20 items per page on client side( items can be additionally filtered) I need to find item among all elements. Then I need to get the page number, where element located and go to that page on client and…
Kronos
  • 482
  • 4
  • 19
3
votes
2 answers

How use if condition for nullable boolean in linq to NHibernate

I have a Person class that Sex property is nullable. public class Person { public bool? Sex {get; set;} } And I have a query by linq to NHibernate. var q = SessionInstance.Query(); if (dto.Sex != null) q = q.Where(p => p.Sex ==…
Ehsan
  • 3,431
  • 8
  • 50
  • 70
3
votes
1 answer

NHibernate projection, AutoMapping, IPagedList, how to?

I have these entities and models: ENTITIES: public class BlogPost { public virtual int Id { get; set; } public virtual IList Keywords { get; set; } public virtual IList Comments { get; set; } } public class…
3
votes
1 answer

NHibernate Query with detached criteria...

I have that : var query = session.Query(); // Here I need to execute a detached criteria, like that : // query.UnderlyingCriteria.Add(SpatialExpression.Within("Geo", extent)); var t = query.Select(item => new MyClassView …
Paul
  • 12,359
  • 20
  • 64
  • 101
3
votes
2 answers

Subquery in Linq to NHibernate

I have a query by Linq in NHibernate 3.1: public IList Search() { var sub_q = SessionInstance.Query().Where(x => x.Id < 6).Select(x => x.Id); var q = SessionInstance.Query(); q = q.Where(x =>…
Ehsan
  • 3,431
  • 8
  • 50
  • 70