Note that there are some explanatory texts on larger screens.

plurals
  1. PODynamic configs with Structuremap
    primarykey
    data
    text
    <p>Here's what I am trying to accomplish with Structuremap.</p> <p><br> On each we request, database connection strings and web service urls used in our clients will vary based on some business logic. Currently, our sql and web service client implementations receive the configs in their constructors.</p> <p>I wanted to use profiles, only to discover that it is not possible to use them per request.</p> <p>In our team, we're having a debate over two solutions:</p> <p><br> 1- Pass a config factory into the registry that can resolve which configurations to use when the container needs to instantiate something.</p> <ul> <li>Problems I see is that we might have to use HttpContext.Items, as most of the app objects are not instantiated in structuremap and it seems hard to get the current request context from within the factory. </li> </ul> <p><br> 2- Instantiate containers for every different configurations and decide which container to use depending on the business logic.</p> <ul> <li>Problems I see is the load time, the memory consumption and maybe the lifecycles of objects. So, I don't seem to find any real problem here, it just feels wrong to me to have multiple containers.</li> </ul> <p><br><br> 1- Do you see other problems? </p> <p>2- Any better idea?</p> <p>3- Which one would you choose? </p> <p><br> Thank you</p> <p><strong>EDIT</strong><br></p> <blockquote> <p>and it seems hard to get the current request context from within the factory.</p> </blockquote> <p>I don't mean HttpContext, I mean the request data. For this app, it is a wcf request object.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload