Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 466547
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T23:29:28+00:00 2026-05-12T23:29:28+00:00

I am facing an issue with an unsupported feature in the LINQ implementation of

  • 0

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 grouping the comments per day and sum up the amount of comments for each day (naturally it has additional properties and correct mapping, written in Fluent NHibernate):

public class Comment
{
    public virtual DateTime CreatedOn
    {
        get;
        set;
    }
}

My LINQ query looks like below (the query works fine if executed against a LINQ to SQL context).

var commentsPerDay = (from c in session.Linq<Comment>()
                      group c by new { c.CreatedOn.Date } into g
                      select new
                      {
                          Date = g.Key.Date,
                          Count = g.Count()
                      };

The proper solution would be to contribute to the project and fix this issue.

On the other hand, I would love to find out if (LINQ to) NHibernate has an extensibility point, where I could inject this behaviour. I know I could probably create a custom type and mapping a second property to the date part of the creation time, but I’m guessing this wouldn’t translate to a query, which would make it too slow.

I have limited access to rewriting the queries, as they still has to work with LINQ to SQL, so I can’t use HQL.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T23:29:29+00:00Added an answer on May 12, 2026 at 11:29 pm

    I’ve only found one solution for it and that is to do the following:

    Select all the results from nhibernate, and then force it to retrieve the results. Then you can perform a group by on the results.

    It would look something like :

    var comments = session.Linq<Comment>().Select(s=> new { s.CreatedOn } ).ToList(); //get all the comments into the results
    var commentsPerDay = comments.GroupBy(c=>c.CreatedOn.Date).Select(foo => new {Date = g.Key, Count = g.Count());  //group by the results
    

    Sorry, I like lamda, but I think you’ll get the idea. You’ll probably want to limit the date range to query across so that you don’t pull back a ton of results.

    (I was previously logged in with the wrong user to google. and posted under that user.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi I'm facing an issue with Eclipse XSL plugin , I'm using extensions feature
I’m facing an issue and i’m wondering if you could help me with it
I am facing an issue with stat() . stat() does not seem to be
I am facing one issue It is not safe to use pixmaps outside the
I am facing strange issue on Windows CE: Running 3 EXEs 1)First exe doing
I am facing issue of the WCF Services on staging server. The same service
I am facing issue with the following Json reponse object in the javascript eval
I am using C# for my programming. I am facing issue, that my hidden
We are facing an issue where the following check fails intermittently in IE: pseudocode:
I am facing strange issue. I have wep-part that reads data from user's profile.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.