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

  • SEARCH
  • Home
  • 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 6711165
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:06:26+00:00 2026-05-26T08:06:26+00:00

i have to retrive some data and count of the rows based on the

  • 0

i have to retrive some data and count of the rows based on the criteria
the bellow is my code snippet

 criteria.SetProjection(Projections.ProjectionList().Add(Projections.Property("LastUpdatedUserName"),"OperatorName")
            .Add(Projections.Property("Created"),"enrollmentdate")
            .Add(Projections.Count("NIK"), "enrollmentcount")
            .Add(Projections.GroupProperty("LastUpdatedUserName"))
            .Add(Projections.GroupProperty("Created")))
            .SetResultTransformer(NHibernate.Transform.Transformers.AliasToEntityMap);
       var result = criteria.List<Demographic>()

and this snippet resulting in exception while running

here goes the exception

ex.message=Unable to perform find[SQL: SQL not available]
ex.innerexception={"The value \"System.Collections.Hashtable\" is not of type \"Indo.Id.Data.Infrastructure.Entities.Demographic\" and cannot be used in this generic collection.\r\nParameter name: value"}

and the stack trace is

at System.ThrowHelper.ThrowWrongValueTypeArgumentException(Object value, Type targetType)
at System.Collections.Generic.List
1.VerifyValueType(Object value)
at System.Collections.Generic.List1.System.Collections.IList.Add(Object item)
at NHibernate.Util.ArrayHelper.AddAll(IList to, IList from) in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Util\ArrayHelper.cs:line 233
at NHibernate.Impl.SessionImpl.List(CriteriaImpl criteria, IList results) in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Impl\SessionImpl.cs:line 1948

type casting of the transformation to demographic will work to max extent but here in demo graphics i have approx 40 columns and i have declared a new class for holding the result like

public class operatorenrollment
{
public string OperatorName { get; set; }
public DateTime enrollmentdate { get; set; }
public int enrollmentcount { get; set; }
}

can i now transform this to new class like

NHibernate.Transform.Transformers.AliasToBean(typeof(operatorenrollment))

any help here is very much appriciable

thanks in adv

  • 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-26T08:06:27+00:00Added an answer on May 26, 2026 at 8:06 am

    The error is pretty clear.

    You are using Transformers.AliasToEntityMap, which transforms your projection into an IDictionary, and trying to get back a list of Demographic.

    Use Transformers.AliasToBean<Demographic>() instead.

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

Sidebar

Related Questions

I have made the following code to retrive data from SQLite database. public Cursor
I have to login in to various elements to retrieve some data, problem is
So, I'm trying to use Doctrine to retrieve some data. I have some basic
In SQL Server, I have a table where a column A stores some data.
I have been trying to think of a way to retrieve some data from
I have a Queue with some data. If I want to retrieve 5 bytes
I have created a report in MS Access report and write some VBA code
I am not a statistics guy but have to deal with quite some data.
I have to retrieve some data from a file to show it in a
I have a binary data file and need to retrieve some data from it.

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.