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

Linq to NHibernate - eager load grandchildren but not children

I am using NHibernate 3.2 with FluentNHibernate and Linq to NHibernate. I want use Linq to NHibernate to eager load all of the grandchildren of a collection without having to load the children. For example, say that I have the following…
3
votes
1 answer

The method or operation is not implemented while using linq to nhibernate

i m trying to use linq to nhibernate 3 and i have made following linq query var a = (from c in Session.Query() join Specific in ( (from choicevaluelocale in…
yrahman
  • 960
  • 5
  • 15
  • 33
3
votes
1 answer

Linq to NHibernate: Sequence Contains no Elements

I know I'm doing something wrong here, I just don't know what as I'm not very sure what the issue is. Here's the code which is called: The call System.Linq.Expressions.Expression> deleg = (m…
Holland Schutte
  • 231
  • 2
  • 10
3
votes
1 answer

subquery Problem in Linq To Nhibernate

I have two classes by Names : Person and Asset by Relation type : One To Many (one person by many asset) I wrote a query by subquery using linq.Nhibernate 2.2 var sub_q = from Asset a in SessionInstance.Linq() …
Ehsan
  • 3,431
  • 8
  • 50
  • 70
3
votes
1 answer

HQL Expression equivalent for data types

Background : I need to create a custom like extension method for linqtohiberante to do the below, result.Where(p => p.MyIntColumn.IsLike('%100%') ); so that would output a custom sql as follows. select * from orders where CONVERT(VARCHAR,…
Illuminati
  • 4,539
  • 2
  • 35
  • 55
3
votes
3 answers

Inner join fetch in Linq query

Is it possible to modify a query (or the mapping) so that the call to the .Fetch() extension method of NHibernate results in a inner join in the generated SQL query? In HQL this is easy, you just have to write inner join fetch instead of left join…
cremor
  • 6,669
  • 1
  • 29
  • 72
3
votes
3 answers

Map One to One Relationship at Run-Time

i'm trying to upgrade an old CMS to use NHibernate and can't deter from the original database structure much. Here is the bit which is causing an issue. Say i have the following 2 tables: Articles: - Id (PK, Identity) - Title - Content Meta: -…
nfplee
  • 7,643
  • 12
  • 63
  • 124
3
votes
2 answers

How to create a collection of Expression>?

I have a repository with the following method: IEnumerable FindAll(Specification specification, Expression> fetchExpression); I need to pass in more than one expression. I was…
3
votes
2 answers

Which one is better for getting the last row of my table with linq to nhibernate?

Which one is better for getting the last row of my table with linq to nhibernate? Why? internal Bill GetLastBill() { var q = from b in session.Linq() select b; return q.OrderByDescending(x =>…
masoud ramezani
  • 22,228
  • 29
  • 98
  • 151
3
votes
3 answers

Comparing arrays of bytes with NHibernate

The following Linq to NHibernate query results in a System.NotSupportedException. IEnumerable FindByMd5(byte[] md5) { return this.Session.Query().Where(f => f.Md5.SequenceEqual(md5)).ToList(); } How should I do this using Linq to…
mll
  • 505
  • 1
  • 4
  • 14
3
votes
1 answer

NHibernate & LINQ: Using Fetch() with custom ToPagedList method

I have a problem with using the nHibernate Fetch() (or FetchMany()) method with my paging method which uses Futures to get the information it needs. And I'm not sure how to fix it but I know exactly what it's doing. Let me explain what I have so…
Nick Albrecht
  • 16,607
  • 10
  • 66
  • 101
3
votes
1 answer

Fetching strategy encapsulation for Entity Framework 4.1 and NHibernate

I created a project to test out NHibernate 3+ vs. Entity Framework 4.1, wrapping it in a repository, making it very testable using interfaces etc. I do not want to expose either ORM outside of the repositories (I do not even expose IQueryables). …
3
votes
0 answers

Left join not working in NHibernate LINQ to entities

I am trying to do left-join using LINQ to NHibernate. I have the following code: var query = from formdat in _formDatRepository.Table join proddat in _prodDatRepository.Table on formdat.prodcode equals proddat.prodcode into…
3
votes
3 answers

NHibernate computed column

I have an entity ("A") that I'm persisting via NHibernate. This entity might have several children of type ("B") in the database, and when I retrieve entity A, I want to have a property that indicates a count of entity B that belong to A. I don't…
Chris
  • 27,596
  • 25
  • 124
  • 225
3
votes
1 answer

Is it possible to call IQuerable.ToFuture() and IQuerable.Fetch() in same query for NHibernate (>3.0) Linq?

I want to use LINQ to NHibernate for a classic counting/pagination scenario: var query = Session.Query().Where(...); var count = query.ToFutureValue(c => c.Count()); var results = query.OrderBy(x => x.Field) …
Vasea
  • 5,043
  • 2
  • 26
  • 30