Although this question is related to StructureMap, my general question is:
When wiring up components with an IoC
container in code (as opposed
to configuring via xml) do you
generally need explicit project/build
references to all assemblies?
Why the separate assemblies? Because:
"Abstract classes residing in a
sepa...
I keep getting a stackoverflow exception when I call "GetInstance" (the last line). All, yes ALL of my types implement ITracker. MultiTracker has a constructor with a single parameter, which is an array of ITracker's.
It seems like StructureMap is ignoring the fact that I told it that MultiTracker is the default class I want when reques...
Here's the current layout:
Solution:
Core
Domain
Interfaces
DataAccess
Providers
Session
Service
UI
UnitTests
IntegrationTests
I typically try to keep my core domain entities / POCOs as light as possible without very many external dependencies.. So I was thinking it might make sense to put it in the Service layer as it typical...
Hi
I want to learn structuremap and how to arrange/structure my DI code, Are there any open source project that uses StructureMap that I can look at for guidance?
...
I am using the generic repository pattern to persist my data. On the PageLoad, I am creating a new Repository (from IRepository) object, and on PageUnload, I dispose of it.
Should the MasterPage/Page be in charge of instantiating the objects to pass to the presenter or should the presenter be in charge of this? I'm more concerned wi...
Hello,
Currently I have an ActionFilter that gets the current users name from HttpContext and passes it into the action which uses it on a service method. eg:
Service.DoSomething(userName);
I now have a reason to do this not at the action level but the controller constructor level. Currently I'm using structure map to create contro...
All examples of StructureMap that I've seen use the static ObjectFactory class to initialize and resolve objects. I however would like to pass around a reference to my container. I assume that ObjectFactory is just a singleton wrapper for a non-static object. But where is it?
...
Using Josh Flanagans StructureMap Automocking overview, I'm trying my hand at it but can get the following code to return the Category object I've assigned:
[Test]
public void Service_Should_Return_Category_From_ID()
{
// Arrange
var categoryToTest = new Category()
{
ID = 1,
Name = "Department 1",
Description = ...
I have a bunch of services that implement various interfaces. eg, IAlbumService, IMediaService etc.
I want to log calls to each method on these interfaces. How do I do this using StructureMap?
I realise this is pretty much the same as this question it is just that I am not using windsor.
...
In my DefaultRegistry I have this configuration:
ForRequestedType<INHUnitOfWork>().CacheBy(InstanceScope.HttpContext)
.TheDefault.Is.OfConcreteType<NHibernateUnitOfWork>();
At some point in the web application flow I want to change the InstanceScope to HttpSession to obtain a long conversation, so I do this:
PluginTypeConfigu...
I have a repository pattern i created on top of the ado.net entity framework. When i tried to implement StructureMap to decouple my objects, i kept getting StackOverflowException (infinite loop?). Here is what the pattern looks like:
IEntityRepository where TEntity : class
Defines basic CRUD members
MyEntityRepository : IEntityReposito...
I normally use StructureMap.dll (from MvcContrib) for dependency injection in .NET.
Is there an equivalent for Silverlight, or any tools anyone uses? I can do it by hand, obviously, and it's not difficult. But I wondered if there was something formalised like StructureMap but for Silverlight.
...
I'm still trying to figure things out with StructureMap and one of the issues i'm running into is my Controller Factory class blowing up when a null controller type is passed to it. This only happens when the application builds for the first time, after which every subsequent build works fine. Even when i shutdown Visual Studio and reope...
Hi folks,
I've got StructureMap working fine on my machine. Everything works great ... until I request a resource that doesn't exist. Instead of a 404, i get a 500 error.
eg. http://localhost:6969/lkfhklsfhskdfksdf
Checking the net, i was told to fix my structuremap controller class. Did that and joy! i now get the -original default 4...
I am using Structuremap in ASP.NET project and I am using
ObjectFactory.Profile = "Mock";
to force the use of a mock further down the system and that all works out fine.
But changing the profile, Will that change of profile affect all requests to my system
or only for the current request?
How can I change the profile in structuremap...
I'm trying to use the MoqAutoMocker class that comes with StructureMap and I can't find any examples of how it should be used. All I have to go on is the example at the StructureMap site that uses RhinoMocks.
What I'm trying to do is get reference to one of my auto-mocked/injected dependencies using the Get method. According to that l...
I am early in development on a new ASP.Net MVC project and I using this project to get into DI. I'm pretty sure that I am going to go with Structure Map, but that isn't what I am asking about. What I am trying to figure out is how best to organize my solution. Do both the unit test project and the model get a configuration file to map th...
I am using mvc.net with StructureMap to scan and register all repositories and services for me. Now I want to register and cache by Singleton. How can I do? Thanks...
IContainer container = new Container(x => {
// Register Repositories and Services
x.Scan(y => {
y.AssemblyContainingType<SomeRepos...
Given
public class Blah : IBlah
{
public Blah(decimal argument)
{
}
}
When
ForRequestedType<IBlah>()
.TheDefault.Is.OfConcreteType<Blah>()
.WithCtorArg("argument")
.EqualToAppSetting("argument_app_setting_key")
Then StructureMap throws the following exception
No Default Instance defined for PluginFamily Sy...
Hi Guys,
I am getting this error while creating the object using structureMap.
The actual error is "Expected file structuremap.config can't be opened at location".
But I can see the config file at that location.
I don't know what im missing.
...