I have a bit of a problem. I have an area called Framed. This area has a home controller. The default for the site also has a home controller.
What I'm trying to do with this is have a version of each controller/action that is suitable for an IFrame, and a version that is the normal site. I do this through Master pages, and the si...
Structure map (2.6).
I have some classes and a registry that look like the following:
public interface IManyType {}
public class ManyType1 : IManyType {}
public class ManyType2 : IManyType {}
public class ManyType3 : IManyType {}
public class TestRegistry : Registry
{
public TestRegistry()
{
For<IManyTy...
Is it possible to pass the requesting type as a parameter when configuring a StructureMap container.
For example:
container.Configure(x => {
x.For<ILogger>().Use(new TestLogger(log.Add, requestingType));
});
Where requesting type is the consuming object's type:
public class SomeClass
...
I am familiar with Ninject and in Ninject you can do something similar to
Bind<ICalendar>().To<MonthCalendar>().WhenInjectedInto(typeof(Roster)).InRequestScope();
I'm not sure how to perform something similar in StructureMap. I need to be able to do this dynamically from my own binding without the use of the generic StructureMap metho...
How to do Dependency Injection on Property of a class Using Structure Map
public class ContactController : Controller
{
public IContactService Service { get; set; }
public ContactController()
: this(null,null)
{
}
[SetterProperty]
public MembershipProvider Provider { get; private set; }
}
Here when i ...
Hi,
We are using StructureMap as our Dependency Injection (DI) framework while we are creating a layered library. Our goals are to:
Make it easy for us to Unit Test classes (and using mock classes instead of the real dependencies) while we develop and maintain the library.
Make it easy for the library user to:
Customize the library b...
I hawe all day strugle my head and i canot find any solution to my case so i nead help. Hear is my problem: I hawe two classes that implement one interface
public interface ICacheObject
{
string Get();
}
public class WebCacheObject : ICacheObject
{
public string Get()
{
return "Web";
}
}
public class SysteCach...
Hello All,
I am new to structuremap. I am trying to get Structuremap to auto-register
public void RegisterAllEventHandlers()
{
Scan(cfg =>
{
cfg.TheCallingAssembly();
//cfg.IncludeNamespaceContainingType<NewCustomerCreated>();
cfg.IncludeNamespace("ParentNameSpace");
cfg.AddAl...
I'm trying to do some attribute-based interception using structuremap but I'm struggling to tie up the last loose ends.
I have a custom Registry that scans my assemblies and in this Registry I have defined the following ITypeInterceptor whose purpose it is to match types decorated with the given attribute and then apply the interceptor ...
I'm using a custom route in my mvc application that inherits from RouteBase.
In my global.asax I register the route like this:
routes.MapPageRoute("PageRoute", ObjectFactory.GetInstance<IRepository>());
In the GetRouteData method I use my repository to fetch the correct page and then I put that in the RouteValueDictionary like this:
...
I can't help but think there is a better way to do this than my current code within my StructureMap Registry.
For<ISchedulerFactory>().Use(() => new StdSchedulerFactory());
For<IScheduler>().Use(() => new StdSchedulerFactory().GetScheduler());
Is there a way to have it use the previous registered type and call the method from that...
I am looking to convert following code to StructureMap:
private Mock<MembershipProvider> MockMembership = new Mock<MembershipProvider>();
private StandardKernel GetIoCKernel()
{
var modules = new IModule[]
{
new InlineModule(
new Action<InlineModule>[]
{
m => m.Bind<MembershipPro...
Hi
I have a requirement to use a plug in model where I need to allow types of ITask to be created by structuremap but where I only have a string of the type name at runtime. These types need to use Ctor injection to be composed, so I can't build up an existing type.
Also, I don't want to get all types and then query the type name as th...
public interface IRepository<T> where T : Entity
{
void Delete(T entity);
T[] GetAll();
T GetById(int id);
void SaveOrUpdate(T enity);
void Merge(T entity);
}
public interface ITeamEmployeeRepository : IRepository<TeamEmployee>
{
PagedList<TeamEmployee> GetPagedTeamEmployees(int pageIndex, int pageSize);
}
publ...