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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T14:03:56+00:00 2026-05-13T14:03:56+00:00

Im new to IOC and StructureMap and have an n-level application and am looking

  • 0

Im new to IOC and StructureMap and have an n-level application and am looking at how to setup the wirings (ForRequestedType …) and just want to check with people with more experience that this is the best way of doing it!

I dont want my UI application object to reference my persistence layer directly so am not able to wire everything up in this UI project.

I now have it working by defining a Registry class in each project which wires up the types in the project as needed. The layer above registers its types and also calls the assembly below and looks for registries so that all types are registered throught the hierrachy.

E.g. I have UI, Service, Domain, and Persistence libraries. In my service layer the registry looks like

        Scan(x =>
        {
            x.Assembly("MyPersistenceProject");
            x.LookForRegistries();
        });

        ForRequestedType<IService>().TheDefault.Is.OfConcreteType<MyService>();

Is this a recommended way of doing this in a setup such as this? Are there better ways and what are the advantages / disadvantages of these approaches in this case?

  • 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-13T14:03:57+00:00Added an answer on May 13, 2026 at 2:03 pm

    This sounds good.

    If you use default conventions, like having a default implementation OrderSevice for the interface IOrderService you can reduce the wiring by using conventions in StructureMap. The WithDefaultConventions is a method in the Registry to use default conventions. You can also specify your own convention and register it in the registry using the method With, see the StructureMap documentation

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

Sidebar

Related Questions

Standard newbie disclaimer: I'm new to IoC and am getting mixed signals. I'm looking
I'm new to IoC and I'm trying to get started using StructureMap, but it
I am brand new to IoC and thus have been following the examples provided
I have the following code: IOC.Container.RegisterType<IRepository, GenericRepository> (Customers, new InjectionConstructor(new CustomerEntities())); What I am
I am new to IoC and Castle Windsor. The question is more related to
For a new legacy application I have to use Latest Spring framework 3.x with
I'm new to IOC containers, and I'm getting started with NInject. What do you
I'm really new to Castle Windsor IoC container. I wanted to know if theres
I am very new to concept of IOC and I understand the fact that
I am pretty new to Unity & IoC in general & as usual, 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.