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

  • Home
  • SEARCH
  • 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 3849446
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T16:51:21+00:00 2026-05-19T16:51:21+00:00

I have a service layer in my application which contains services such as AccountService

  • 0

I have a service layer in my application which contains services such as AccountService, UserService and DocumentService.

I use StructureMap for my dependency injection so the constructor of my service might look like this:

public AccountService(IAccountRepository repo)
{
    this.accountRepository = repo;
}

Now if I need access to say the UserService whilst in there is it good form to have the following?

public AccountService(IAccountRepository repo, IUserService user)
{
    this.accountRepository = repo;
    this.userService = user;
}
  • 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-19T16:51:22+00:00Added an answer on May 19, 2026 at 4:51 pm

    Yes, it perfectly fine. You can download the code and watch the episodes Rob Conery prepared.

    public class CatalogService : Commerce.Services.ICatalogService 
    {
        ICatalogRepository _repository = null;
        IOrderService _orderService = null;
    
        /// <summary>
        /// Creates a CatalogService based on the passed-in repository.
        /// </summary>
        /// <param name="repository">An ICatalogRepository</param>
        public CatalogService(
            ICatalogRepository repository, IOrderService orderService) 
        {
            _repository = repository;
            _orderService = orderService;
    
            if (_repository == null)
                throw new InvalidOperationException("Repository cannot be null");
        }
        ...
    }
    

    He injects the OrderService in the CatalogService.

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

Sidebar

Related Questions

I have a simple WCF service application which contains a list of room items
We have an application in which we have created a service layer with most
I have a layered application with namespaces: App.Core - business layer logic services App.Data
I have a service, business and data access layer. In which layer should I
I have a WCF service layer in my application that passes DTOs to UI.
In a Spring web application I have several DAO and service layer beans. One
In my Spring application I have service-layer methods marked as @Transactional(propagation=Propagation.REQUIRED) and am using
I have three layers in my application: REST interface (JBOSS RestEasy) Service layer (Spring
I have four lists in my webflow, which I load from my service layer.
I'm using HTML+JQuery as UI, Spring-Roo to generate service layer which contains Json object

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.