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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T00:36:52+00:00 2026-06-04T00:36:52+00:00

This may be a basic question, but is System.Data.SqlClient Specific to SQL Server Only?

  • 0

This may be a basic question, but is System.Data.SqlClient Specific to SQL Server Only?

I would like to use the System.Data.SqlClient.SortOrder as a method parameter to my repository interface IRepository.Find(), but don’t want to use a SQL Server specific argument.
Is there a vendor-neutral version of the SortOrder enum?

For now, I am just using a string parameter called sortOrder which just takes the value “asc” or “desc” or just create my own enum.

Here is the implementation of the method in question:

public ICollection<T> Find(Expression<Func<T, bool>> predicate, int pageNumber, int size, Expression<Func<T, object>> orderBy, string sortOrder, out int count, params Expression<Func<T, object>>[] fetchSelectors)
{
    count = (this.DbSet as IQueryable<T>).Count(predicate);

    if (size < 1 || size > count)
    {
        throw new ArgumentOutOfRangeException("size");
    }

    var maxPageNumber = (count + size - 1) / size;
    if (pageNumber < 1 || pageNumber > maxPageNumber)
    {
        throw new ArgumentOutOfRangeException("pageNumber");
    }
    if (sortOrder != "asc" && sortOrder != "desc")
    {
        throw new ArgumentException("sortOrder");
    }

    var skipCount = pageNumber * size;
    var query = BuildQuery(predicate, fetchSelectors);
    query = sortOrder == "asc" ? query.OrderBy(orderBy) : query.OrderByDescending(orderBy);
    return query.Skip(skipCount).Take(size).ToList();
}
  • 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-04T00:36:54+00:00Added an answer on June 4, 2026 at 12:36 am

    From MSDN, yes this is SQL Server specific.

    The System.Data.SqlClient namespace is the.NET Framework Data Provider
    for SQL Server.

    Collation will likely be provider-specific, although the semantics (ASC/DESC) are common.

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

Sidebar

Related Questions

This may seem like a realy basic question but... How do you use double
This may be a basic question but I'm not very proficient in SQL Server.
This may seem like a basic question. I have a light-weight website and would
this may seem like a very basic question, but i have difficulty grasping it,
This may be a basic question but how can I include a module with
This may seem a basic question but my is not currently working. I am
This may seem like a simple question but i am getting an error when
This may be a basic question but I am pretty new to DDD. I
This may be a basic question but I am new to grails and tried
This may be a basic question but the answer has alluded me so far.

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.