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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T15:56:17+00:00 2026-06-03T15:56:17+00:00

If I have a service (service-layer object not web service) called WidgetProcessor and that

  • 0

If I have a service (service-layer object not web service) called WidgetProcessor and that service only has one method named Process() Within that method I use another service (service-layer object). Let’s call this service WidgetValidator it has a method Validate() that gets called from within a Parallel.ForEach.

1) I’m assuming if I do nothing that the Validate method, if it performs multiple calculations that it will not be thread safe… correct?
2) What is the proper way to inject the WidgetValidator object. If I inject WidgetValidator at via the constructor and assign it to a class level private variable – seems like that would be less thread safe… well, compared with new’ing up a WidgetValidator inside the Parallel.ForEach. But something about this all leaves me thinking “Code Smell”! Should I just put apply a lock to the code inside the Validate method.

Note: I’m using Ninject as my IoC Container.

  • 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-03T15:56:19+00:00Added an answer on June 3, 2026 at 3:56 pm

    It depends on if the Validator is mutating shared state. If it isn’t then you can reuse the same instance. If it is mutating shared variables you can’t invoke it concurrently.

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

Sidebar

Related Questions

I have a Java enterprise application that provides a web service, has a domain
I have a REST web-service interface that calls-down to a service layer which orchestrates
I have a web application which calls WCF service to get an object. I
I have a web from that has a few text boxes which are visible
I have a web service that is quite heavy on database access. It works
We have a large news-oriented site that has high web traffic. The architecture is
I have a Web Service ( model-layer ) which communicates with Database. This module
I have the standard repository pattern with a service layer and I need to
I have this sort of format asp.net MVC View -> Service Layer -> Repository.
I have a service, business and data access layer. In which layer should 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.