Is there any way to auto-configue Automapper to scan for all profiles in namespace/assembly? What I would like to do is to add mapping profiles to AutoMapper from given assembly filtered by given interface, something like Scan Conventions in StructureMap:
public static void Configure()
{
ObjectFactory.Initialize(x =>
...
I'm trying to get structuremap to build Fluent Nhibernate's SessionSource object for some of my intregration tests. The only problem is that Fluent's concrete implementation of ISessionSource (SessionSource) has 3 constructors:
public SessionSource(PersistenceModel model)
{
Initialize(new Configuration().Configure(), m...
I am using structuremap in my project. To inject different implementation of a repository, I want to have a switch in app.config which changes all real implementation of a repository to a mock repositories.
Lets say IRepository has two implementations RealRepository and MockRepository
ForRequestedType()
.TheDefaultIsCon...
Hi
I'm having difficulty figuring out how to store an explicitly user generated instance in StructureMap, cached by HttpContext.
When I try the code underneath, I even get the first cached instance, which leads to failures when using it for storing user credentials in Asp.Net AuthenticateRequest method.
ForRequestedType<TInterface>()
...
Continuing on my quest for a good plugin implementation I have been testing the StructureMap assembly scanning features.
All plugins will inherit from abstract class PluginBase. This will provide access to common application services such as logging. Depending on it's function, each plugin may then implement additional interfaces, for e...
I'm trying to use StructureMap in an asp.net MVC application instead of using HttpSession to store instances.
My simple test class:
public interface ICurrentSession
{
User User { get; set; }
}
public class CurrentSession : ICurrentSession
{
public User User { get; set; }
}
Here is the relevant registry code which is called in ...
Hello,
I am trying to use StructureMap to register some types that implement a generic interface and are instantiated via a factory.
My code:
public interface IManagerBase<T, TKey> : IDisposable
{
// Get Methods
T GetById(TKey Id);
}
public partial interface IServerHostManager : IManagerBase<ServerHost...
I'm using the Agatha request/response library (and StructureMap, as utilized by Agatha 1.0.5.0) for a service layer that I'm prototyping, and one thing I've noticed is the large number of handlers that need to be created. It generally makes sense that any request/response type pair would need their own handler. However, as this scales ...
I'm implementing StructureMap in a multi-tenant ASP.NET MVC application to inject instances of my tenant repositories that retrieve data based on an ITenantContext interface. The Tenant in question is determined from RouteData in a base controller's OnActionExecuting.
How do I tell StructureMap to construct TenantContext(tenantID); wher...
I am currently integrating StructureMap within our business layer but have problems because of bidirectional dependencies.
The layer contains multiple manager where each manager can call methods on each other, there are no restrictions or rules for communication. This also includes possible circular dependencies like in the example belo...
Hello guys, I have a generic IRepository that has 2 constructors, one have none parameters, other has the datacontext as parameter.
I want to define to structuremap to aways in this case use the parameterless constructor.
I want a way to create a parameterless contructor, other solutions that I have seen, they create a new Datacontext a...
Hi.
I have interface IModule and several classes that implements it.
In test i need to create instance of each type(class) implementing that interface.
Is is possible(with StructureMap)?
...
i have 2 concrete types "CategoryFilter" & "StopWordsFilter" that implements
"IWordTokensFilter".
Below is my setup:
ForRequestedType<IWordTokensFilter>().TheDefaultIsConcreteType<CategoryFilter>()
.AddInstances(x =>
{
x.OfConcreteType<StopWordsFilter>();
}
);
The problem is...
Hi,
I've got the simplest kind of circular dependency in structuremap - class A relies on class B in its constructor, and class B relies on class A in its constructor. To break the dependency, I made class B take class A as a property, rather than a constructor argument, but structuremap still complains.
I've seen circular dependencies ...
I am learning about best practices in MVC2 and I am knocking off a copy of the "Who Can Help Me" project (http://whocanhelpme.codeplex.com/) off Codeplex. In it, they use Castle Windsor for their DI container. One "learning" task I am trying to do is convert this subsystem in this project to use StructureMap.
Basically, at Application_...
Hi.
I'm trying to get StructureMap to put a Castle.DynamicProxy around some of the objects it creates. I have used the EnrichWith-feature earlier, but I think RegisterInterception would suit me better in this case, since I use scanning.
The problem is that in the "Process(object target, IContext context)"-method, I can't find out which...
I was using the default AspNetSqlMembershipProvider in my application. Authentication is performed via an AuthenticationService (since I'm also supporting other forms of membership like OpenID).
My AuthenticationService takes a MembershipProvider as a constructor parameter and I am injecting the dependency using StructureMap like so:
F...
Currently I am working on an application which depends on a lot of external web services. A few of them are authorize.net and chargify.
When testing(manual testing) things other than the integration with these web services, I replace these web service dependencies with fake versions of them which don't really do anything. The way I am...
In the project I'm working on I have a StructureMap registry for the main web project and another registry for my integration tests. During some of the tests I wire up the web project's registry, so that I can get objects out of the container for testing.
In one case I want to be able to replace a default concrete type from the web reg...
Hello,
I'm using StructureMap for my DI. Imagine I have a class that takes 1 argument like:
public class ProductProvider : IProductProvider
{
public ProductProvider(string connectionString)
{
....
}
}
I need to specify the "connectionString at run-time when I get an instance of IProductProvider.
I have conf...