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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:26:21+00:00 2026-05-26T09:26:21+00:00

I have a rather large SOA solution and a newly added service queries approx

  • 0

I have a rather large SOA solution and a newly added service queries approx 9.8 million records using NHibernate’s Query By Example. Thus far the performance has been terrible, and a profile on the database shows the query as:

exec sp_executesql N'SELECT this_.Id as Id3_0_, this_.ESIID as ESIID3_0_, this_.ADDRESS as ADDRESS3_0_, this_.ADDRESS_OVERFLOW as ADDRESS4_3_0_, this_.CITY as CITY3_0_, this_.STATE as STATE3_0_, this_.ZIP5 as ZIP7_3_0_, this_.ZIP4 as ZIP8_3_0_, this_.DUNS as DUNS3_0_, this_.PREMISE_TYPE as PREMISE10_3_0_, this_.STATUS as STATUS3_0_, this_.METER_READ_CYCLE as METER12_3_0_, this_.STATIONCODE as STATION13_3_0_ FROM vw_TDSP_ESIID this_ WHERE (lower(this_.ADDRESS) like lower(@p0) and lower(this_.CITY) like lower(@p1) and lower(this_.STATE) like lower(@p2) and lower(this_.ZIP5) like lower(@p3) and lower(this_.ZIP4) like lower(@p4))',N'@p0 nvarchar(10),@p1 nvarchar(2),@p2 nvarchar(4),@p3 nvarchar(7),@p4 nvarchar(2)',@p0=N'%110 Main%',@p1=N'%%',@p2=N'%TX%',@p3=N'%77002%',@p4=N'%%'

So, basically because my code looks like:

var queryEx = Example.Create(esiIdEntityProto)
            .EnableLike(MatchMode.Anywhere)
            .ExcludeNulls()
            .ExcludeZeroes()
            .IgnoreCase();

NHib is using the like operator everywhere, which I get because that’s how I set it up. But is it possible to set up some fields to be like and some to be equals? I need Zip5 to be EQUAL and state to be EQUAL…but the rest can be LIKE.

Or did I just ruin QBE so I might as well use regular old criteria?

  • 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-26T09:26:22+00:00Added an answer on May 26, 2026 at 9:26 am

    you can mix

    .ExcludeProperty("Zip5")
    
    
    .Add(example).Add(Restrictions.Eq("Zip5", esiIdEntityProto.Zip5))
    

    or

    .ExcludeProperty("ADDRESS")
    
    
    .Add(example).Add(Restrictions.Like("ADDRESS", esiIdEntityProto.Address))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a rather large file (150 million lines of 10 chars). I need
I have a rather large (freeware) project written with Delphi 2007 which is using
So I am using jQuery and I have a rather large table for what
I have a rather large solution consisting of about 10 different projects. Until now
I have a rather large database exposed to my application using LINQ-to-SQL. I need
I have a rather large solution consisting of several projects that wants to install
I have a rather large solution with some Silverlight and WPF projects inside it,
I have a rather large save routine that updates hundreds of items using the
Okay, so we have a rather large solution with about 8 different projects inside
We have a rather large VS 2010 solution that contains several C++ projects depending

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.