A provider for NHibernate library for .NET Framework which allows to use LINQ queries. Available since version 3.0.
Questions tagged [linq-to-nhibernate]
629 questions
0
votes
1 answer
nHibernate self referencing table fetch many
I have a self-referencing table which I use to build my tree view.
I use the following query to get the right structure:
public IList GetAllTreeNodes(string userid)
{
var query = Session.Query()
…

stefan
- 1,336
- 3
- 21
- 46
0
votes
2 answers
FluentNhibernate - query with ReferencesAny
When using ReferencesAny<> there is .EntityTypeColumn("MyType") which is not visible to application.
Is there option to query by that column using HQL or something and how to integrate into my LINQ to HQL queries?

Andrej Kaurin
- 11,592
- 13
- 46
- 54
0
votes
1 answer
Mapping in Nhibernate
I am using NHibernate 3.3 with vb.net
I am trying to mapping through code but it results in cannot create an instance of interface.
Code is as below.
Dim cfg As New Configuration()
cfg.Properties.Add(NHibernate.Cfg.Environment. _
…

Muhammad Ali Hassan
- 960
- 2
- 12
- 29
0
votes
1 answer
Linq-to-NHibernate String/DateTime Conversion in Where
I'm just starting out with Linq to NHibernate and having troubles with a pretty simple query. I have a database column that is defined as a varchar. In the linq query I need to compare that value to a datetime value (all of the values stored in…

Jeff
- 155
- 2
- 9
0
votes
2 answers
NHibernate filter criteria - Hour of DateTime
I am having hard times convincing NHibernate (EF was able to do it) to filter based on the Hour property of a DateTime entity property. My entity goes something like :
public class Invoice {
// ...
public DateTime Time { get; set; }
//…

Andrei Rînea
- 20,288
- 17
- 117
- 166
0
votes
2 answers
Expanding collections with EntitySetController in MVC Web Api
I'm using the OData framework (version 5.0.0) together with MVC Web Api (MVC version 4.0.305060), and cannot get the $expand query to work for my collections.
According to this wiki page, and more specifically case #2 under "Supported scenarios", I…

nforss
- 1,258
- 1
- 17
- 31
0
votes
1 answer
Prevent accessing database twice for the same query inside one session
For example:
User user = GetSession().Query().SingleOrDefault(u => u.Login == login);
That query could evaluated twice in my code from different methods (check if user exist and save some data to cookies). Profiler shows that nhibernate…

Ievgen Martynov
- 7,870
- 8
- 36
- 52
0
votes
1 answer
LINQ: QuerySyntaxException
I've written some complex LINQ query which I'm trying to run against NHibernate, unfortunately this causes an exception when trying to evaluate the query (call .ToList()).
Here is the code, which is supposed to retrieve Issue objects with some extra…

migajek
- 8,524
- 15
- 77
- 116
0
votes
2 answers
Select parent and count of children in Nhibernate using Linq in the same query
I am trying to learn MVC and nHibernate by creating a simple blog application.
I have a posts table and a comments table. Each post can have multiple comments. Now in my view I have to display the details of the post and the number of comments.
I…

madaboutcode
- 2,137
- 1
- 16
- 23
0
votes
2 answers
time of executing query nhibernate
i have this query in nhibernate
var fdata = (from p in _session.Query()
join d in _session.Query() on p.WfTaskDetail.Id equals d.Id
orderby p.ActionDate descending //(order)
…

user1251552
- 29
- 6
0
votes
2 answers
select parent given child id
A seemingly simple problem turns out more difficult than I thought:
public class SomeCategory
{
public virtual int Id { get; set; }
public virtual IList SomeInstances { get; set; }
}
public class SomeClass
{
public virtual…

cs0815
- 16,751
- 45
- 136
- 299
0
votes
3 answers
NHibernate Linq uses implicit transaction?
I'm using Ayende's NHibernate Linq version 2.1.2, available here, and when I use NHProf to inspect queries that use this method:
public IQueryable GetAll()
{
return Session.Linq();
}
It gives me the warning that I'm using an implicit…

Daniel T.
- 37,212
- 36
- 139
- 206
0
votes
2 answers
Castle ActiveRecord using Linq to Nhibernate Example
I have been using the ActiveRecord library for many years. Recently I started a new project and I'm including the AR 2.0 release in this project. I saw that it shipped with the Linq to Nhibernate library. Are there any good examples of how to use…

Eric Neunaber
- 431
- 3
- 10
0
votes
1 answer
average values for given resolution of minutes for datetime value pairs
The following query seem to work quite fine:
var query =
Session.Query()
.Where(
p =>
p.Timestamp >= from.Now
&& p.Timestamp <= to.Now
)
.GroupBy(x => x.Timestamp)
.AsEnumerable()
.Select(
x…

cs0815
- 16,751
- 45
- 136
- 299
0
votes
1 answer
Not sure how to join tables using Fluent NHibernate
I'm using NHibernate on legacy tables and after looking through our codebase, I seem to be the only person with this need. I need to join two tables so I can run a query, but I haven't made any progress today. I'll try to abbreviate where it makes…

user1290284
- 85
- 2
- 12