We are using the beloved Ninject+Ninject.Web.Mvc with MVC 2 and are running into some problems. Specifically dealing with 404 errors. We have a logging service that logs 500 errors and records them. Everything is chugging along just perfectly except for when we attempt to enter a non-existent controller. Instead of getting the desire...
Anybody know where is the source of ninject compact framework? Any version is acceptable
...
Let's say I have some class with dependency injected:
public class SomeBusinessCaller {
ILogger logger;
public SomeBusinessCaller(ILogger logger) {
this.logger = logger;
}
}
My question is, how do I instantiate an object of that class? Let's say I have an implementation for this, called AppLogger. After I say
ObjectFa...
I understand basically how IoC frameworks work, however one thing I don't quite get is how code-based config is supposed to work. With XML I understand how you could add a new assembly to a deployed application, then change the config in XML to include it. If the application is already deployed (i.e., compiled in some form) then how can ...
Hi guys, i am in big dilema..
I am working on highly modular web app in ASP.NET MVC 2 (in fact, core will be super lightweight, all work on modules/plugins). I found MEF pretty useful for modules discovery, but i dont want to us it as IoC container. There is pretty good chance that I will need advanced features of "true" IoC container, s...
public class TheController : Controller
{
IThe the;
public TheController( IThe the)
{
//when User.IsInRole("r1") The1 should be injected else r2
this.the = the;
}
}
public class The1 : IThe{}
public class The2 : IThe{}
//anybody knows a good way of doing this ?
...
Hi,
Just trying to still get my head around IOC principles.
Q1: Static Methods - Should util classes with static helper methods be wired up with IOC?
For example if I have a HttpUtils class with a number of static methods, should I be trying to pass it to other business logic classes via IOC?
Follow on questions for this might be:
...
When working with NHibernate and Sql Compact in a Windows Form application I am wondering what is the best practice for managing connections. With SQL CE I have read that you should keep your connection open vs closing it as one would typically do with standard SQL. If that is the case and your using a IoC, would you make your repositori...
Castle Windsor facilities allow you to hook up some custom code that runs whenever components are registered. Does Unity have an equivalent?
...
In my project I register many ISerializers implementations with the assembly scanner. FWIW this is the code that registers my ISerializers
Scan(scanner =>
{
scanner.AssemblyContainingType<ISerializer>();
scanner.AddAllTypesOf<ISerializer>().NameBy(type => type.Name);
scanner.WithDefaultConventions();
});
Which then correct...
StructureMap newbie question.
public class SomeClass: IInterface1, IInterface2 {
}
I would like the following test to pass:
Assert.AreSameInstance(
container.GetInstance<IInterface1>(),
container.GetInstance<IInterface2>());
How would I do an explicit registration of this?
I know in Castle Windsor I would do something lik...
All the examples I can find for the Unity InterfaceInterceptor require you to use Attributes to hook-up an ICallHandler to an artifact that you want to intercept. Is it possible to use an InterfaceInterceptor without needing to declare attributes so for example I can apply the interception to all classes?
...
At a certain point, during the running of my app, I want Castle.Windsor to release everything cached in memory. Is this impossible for a singleton object?
...
Any idea how I can tell AutoMapper to resolve a TypeConverter constructor argument using StructureMap?
ie. We have this:
private class StringIdToContentProviderConverter : TypeConverter<string, ContentProvider> {
private readonly IContentProviderRepository _repository;
public StringIdToContentProviderConverter(ICon...
Hey all,
I'm using iBatis.net as my ORM and Structuremap for my IOC library. I'm currently trying to figure out how to get iBatis to use the IOC container to create objects instead of relying on the default constructor. Is there a way that anyone knows of to enhance iBatis in such a way?
Currently as a work around I'm doing a hack of a...
(This question does not rely on a specific IoC framework, so the interfaces and types in my samples are meta-types. Just replace them with the appropriate types for your favorite IoC framework in your head.)
In my main methods, I typically set up my container doing something like this:
static void Main()
{
IInjector in = new Inject...
I'm trying to understand when I should use a container versus manually injecting dependencies. If I have an application that uses a 1-2 interfaces and only has 1-2 concrete implementations for each interface, I would lean towards just handling that myself.
If I have a small application that uses 2-3 interfaces and each interface has ...
I am using Castle Windsor for IoC, and have the configuration held in the web.config/app.config, using the following factory:
public static TYPE Factory(string component)
{
var windsorContainer = new WindsorContainer(new XmlInterpreter());
var service = windsorContainer.Resolve<TYPE>(component);
if (service ...
I have set up a NInject (using version 1.5) binding like this:
Bind<ISessionFactory>().ToMethod<ISessionFactory>(ctx =>
{
try
{
// create session factory, might fail because of database issues like wrong connection string
}
catch (Exception e)
{
throw new DatabaseException(e);
}
}).Using<Singleto...
I have tried to understand AOP, Dependency Injection and Inversion of Control SPRING related concepts but I am having hard time understanding it.
Can anyone explain this in simple English ?
...