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 7936915
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:21:48+00:00 2026-06-03T22:21:48+00:00

Hello i got some method that generating where statment programmatically how can i move

  • 0

Hello i got some method that generating where statment programmatically how can i move where generation to other class method anyone can help ?

        public static List<MME.Objects.TypedLists.InvoiceList> GetList(List<MMPFramework.SearchParameter> parameter)
    {
        MME.Objects.Invoice Invoice = null;
        MME.Objects.Contractor Contractor = null;
        MME.Objects.Contract Contract = null;
        MME.Objects.TypedLists.InvoiceList invoiceList= null; 
        var t = MME.DAL.NhSessionHelper.GetCurrentSession().QueryOver<MME.Objects.Invoice>(() => Invoice);

        foreach (var searchParameter in parameter)
        {
            if(searchParameter.Expression == "Like")
            {
                t.Where(Restrictions.Like(searchParameter.PropertyName, searchParameter.ObjectValueLo));
            }
            else if (searchParameter.Expression == "Eq")
            {
                t.Where(Restrictions.Eq(searchParameter.PropertyName, searchParameter.ObjectValueLo));
            }
            else if (searchParameter.Expression == "Between")
            {
                t.Where(Restrictions.Between(searchParameter.PropertyName, searchParameter.ObjectValueLo,searchParameter.ObjectValueHi));
            }
            else if(searchParameter.Expression == "Gt")
            {
                t.Where(Restrictions.Gt(searchParameter.PropertyName, searchParameter.ObjectValueLo));
            }
            else if (searchParameter.Expression == "Lt")
            {
                t.Where(Restrictions.Lt(searchParameter.PropertyName, searchParameter.ObjectValueLo));
            }
            else
            {
                //todo more
            }
            //t.Where(Restrictions.Eq(searchParameter.PropertyName, searchParameter.ObjectValue));

        }
        t.JoinQueryOver(() => Invoice.Contractor, () => Contractor, JoinType.LeftOuterJoin)

            .JoinQueryOver(() => Invoice.Contract, () => Contract, JoinType.LeftOuterJoin)
            .Select(Projections.Property(() => Invoice.Id).WithAlias(() => invoiceList.Id),
                    Projections.Property(() => Invoice.Number).WithAlias(() => invoiceList.InvoiceNumber),
                    Projections.Property(() => Contractor.Name).WithAlias(() => invoiceList.ContractorName),
                    Projections.Property(() => Contract.Number).WithAlias(() => invoiceList.ContractNumber)
            )
            .TransformUsing(Transformers.AliasToBean<MME.Objects.TypedLists.InvoiceList>());
        return t.List<MME.Objects.TypedLists.InvoiceList>().ToList();

    }

I’ve tried with this but it seems to not work…. Hope someone was doing something and can help me to handle with it.

    public class BaseList
{
    public object WhereGenerator(object ob)
    {
        QueryOver Ded = ob as QueryOver;
        return null;
    }
}
  • 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-06-03T22:21:51+00:00Added an answer on June 3, 2026 at 10:21 pm
    foreach (var restriction in BaseList.Createrestrictions(parameter))
    {
        t.Where(restriction);
    }
    
    
    public class BaseList
    {
        public IEnumerable<AbstractCriterion> Createrestrictions(List<MMPFramework.SearchParameter> parameter)
        {
            return parameter.Select(ToCritieria);
        }
    
        private AbstractCriterion ToCritieria(SearchParameter searchParameter)
        {
            if(searchParameter.Expression == "Like")
            {
                return Restrictions.Like(searchParameter.PropertyName, searchParameter.ObjectValueLo);
            }
            else ...
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello I'm doing some tests using reflection... so far I've got this: public class
Ok I kinda got stucked on the basics.I have a method in class that
So I've got some data that's been compressed with PHP's gzcompress method: https://www.php.net/manual/en/function.gzcompress.php How
Hello folks, I've got the issue to add a browser event to some input
I got this code in my submit form <form id=myform action='hello.php' method='GET'> <input type=button
I'm developing some RESTful services in WCF 4.0. I've got a method as below:
I've got this code that works: def testTypeSpecialization: String = { class Foo[T] def
Hello there i got some code here; <script type=text/javascript> $(function(){ var playListURL = 'http://gdata.youtube.com/feeds/api/playlists/8BCDD04DE8F771B2?v=2&alt=json&callback=?';
Say I've got some throw-away sample procedure that looks like this: CREATE procedure simpletestproc_prc
I've got some perfectly lovely C99 codes that are compiled from multiple .c files,

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.