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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T23:27:12+00:00 2026-05-12T23:27:12+00:00

I have a question re: performance and design. Crux of the problem is: do

  • 0

I have a question re: performance and design. Crux of the problem is: do I wrap RunWithElevatedPriviledges around a sequence of methods all requiring its use (but the call is in the wrong layer), do I call it each time in the appropriate later.

I am refactoring code that initially had 2 layers (front-end & database).

I’ve now split this out into 4 layers

  • Front-end (Sharepoint)
  • Service-layer
  • Data-access-layer
  • Database

Now, owing to a prescribed configuration I need to throw RunWithElevatedPriviledges around the sql queries so that the app pool can authenticate against the database (please dont post comments telling me this is a bad idea, I realise this is a terrible idea but it’s not my call).

For each data call I will have to be in elevated privileges. For my mind, this should happen in the Service layer. The FE should have no clue about this requirement and neither should the Data Access Layer. However, the service layer is called multiple times to populate a series of dropdowns

i.e.

userlistbox.datasource = MyService.GetUsers(); //Returns an iEnumerable object
citylistbox.datasource = MyService.GetCities(currentRegion); //Returns an iEnumerable object

etc.

The unrefactored version wraps all of these calls with the elevated privileges. My sense is that it will be slightly less performant to push this into the service layer but that it’s a better design.

Thoughts? And please, no bashing the constraints I can’t do anything about.

  • 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-12T23:27:12+00:00Added an answer on May 12, 2026 at 11:27 pm

    Better in the Service layer than in the Front End. Maybe you could pass the SPSecurity.CodeToRunElevated Delegate?

    http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spsecurity.codetorunelevated.aspx

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

Sidebar

Related Questions

I have a question that involves a performance question and Mongo Design. Currently a
I have an HBase schema-design related question. The problem is fairly simple - I
I have a question about a performance of stored procedures in the ADS. I
I have a ADO.NET/TSQL performance question. We have two options in our application: 1)
I have read many question about improving the performance of C++ and C code
I am making a webapp. I have a fairly basic question about javascript performance.
This question is related to database/RDBMS where i have little knowledge regarding performance and
I have two questions related to the performance of Dozer using its Java API:
I have some basic questions around understanding fundamentals of Performance testing. I know that
I am new to SQL and I have a basic question about performance. I

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.