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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T05:08:12+00:00 2026-05-19T05:08:12+00:00

Inspired by http://huyrua.wordpress.com/2010/08/25/specification-pattern-in-entity-framework-4-revisited i have decided to write all nontrivial queries over specifications. But

  • 0

Inspired by http://huyrua.wordpress.com/2010/08/25/specification-pattern-in-entity-framework-4-revisited i have decided to write all nontrivial queries over specifications.
But у encountered a problem that i dont know how to use one specification in a few functions:

public bool CheckAccountEmailExist(string email)
{
    var emailExistSpec = new Specification(a => a.Email.ToUpper() == email.ToUpper());
    return _accountRepository.GetBy(emailExistSpec).Any();
}

public bool CheckAccountEmailExist(string email, Guid exceptAccountId)
{
    var emailExistSpec = new Specification(a => a.Email.ToUpper() == email.ToUpper());
    var exceptAccountSpec = new Specification(a => a.Id != exceptAccountId);
    return _accountRepository.GetBy(emailExistSpec.And(exceptAccountSpec)).Any();
}

I want to extract specification “a => a.Email.ToUpper() == email.ToUpper()” to use it in both functions, but i should parametrize it with “email” (function parameter). How can I do this?

  • 1 1 Answer
  • 3 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-19T05:08:13+00:00Added an answer on May 19, 2026 at 5:08 am

    For some reason I can’t view the page that you link to, but I imagine that it would go something like this:

    class EmailSpecification : Specification {
        public EmailSpecification(string email) :
            base(a => a.Email.ToUpper() == email.ToUpper())
        {
        }
    }
    

    Then:

    public bool CheckAccountEmailExist(string email) {
        var emailExistSpec = new EmailSpecification(email);
        return _accountRepository.GetBy(emailExistSpec).Any();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Inspired by the XKCD geohashing comic (http://imgs.xkcd.com/comics/geohashing.png), I thought I'd have a go at
I've been inspired by yehuda katz ( http://yehudakatz.com/2010/07/29/everyone-who-tried-to-convince-me-to-use-vim-was-wrong/ ) to start using Vi (or
It's all in the title. Inspired by http://www.reddit.com/r/programming/comments/dx8au/lessons_from_evernotes_flight_from_net/ Edit: I am primarily thinking about
My question is partially inspired by this article written by Eric Lippert: http://blogs.msdn.com/ericlippert/archive/2009/10/19/what-is-this-thing-you-call-thread-safe.aspx Using
I was quite inspired by Bret Victor's Inventing on Principle video (http://vimeo.com/36579366). Also, I
After watching Sussman's lecture http://www.infoq.com/presentations/We-Really-Dont-Know-How-To-Compute , I am inspired to give core.logic and core.match
Inspired by the discussion in this question . We have all been taught that
I was a bit inspired by this blog entry http://blogs.technet.com/dmelanchthon/archive/2009/07/23/windows-7-rtm.aspx (German) The current notion
This question is inspired from Joel's Making Wrong Code Look Wrong http://www.joelonsoftware.com/articles/Wrong.html Sometimes you
First of all my code (largely inspired from ZMQ doc http://zguide.zeromq.org/py:mtserver ): import zmq

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.