inversion-of-control

How to prevent Castle Windsor from injecting property dependencies?

Is there a way to prevent Castle Windsor from automatically injecting dependencies into properties (besides the [DoNotWire] attribute)? ...

When not to use IoC and DI?

I see lots of articles saying how great IoC and DI are and none about why it isn't so great because it can make code more complex. I see also that IoC shouldn't be in the core part of your code but more for libraries and plug-ins. Articles usually a small reference to how the two patterns can make code more complicated but not much on t...

Performing logging operations in MVC .NET

i'm trying to work out the best method to perform logging in the application i'm currently developing. right now, i have a Log table that stores the username, timestamp, action, controller, and a message. when a controller is instantiated, it gets the IoC info through Castle Windsor. for example, my "Sites" controller is created as fo...

Example of Dependency Injection with only base class

Is it possible to do DI without any third party tools? I've read about people doing it with an abstract class and interface before they discovered some DI framework. How is ID done in that very basic form? ...

What is the reasoning behind this ioc behavior (Resolve with multiple registered components)

Seems like a standard approach for an ioc when given a scenario like (C# windsor): container.AddComponent<ILogger, HttpLogger>(); container.AddComponent<ILogger, SmtpLogger>(); var logger = container.Resolve<ILogger>(); Would be that when resolving the component, the first registered ILogger (HttpLogger in this case) is the only cand...

IOC are at the class level, but what about database conflicts?

With IOC I understand you can substitue implementations out by merely editing a configuration file etc. BUT, what happens when the classes are married to particular database tables and sprocs, you can't just swap out an implementation since the classes/entities are tied to particular tables and stored procedures. Am I right here? ...

What are the shortcomings and annoyances in Ninject and/or StructureMap DI/IoC implementations

I'm looking to replace a home-grown IoC implementation with a standard one. My needs are very simple, translating an interface type into a newly created concrete class. I think you'll agree basically any framework will handle this. Currently I'm narrowing the field down to the following: Ninject StructureMap So again, the question...

Help getting DI/IoC in house

Hi all, I am trying to introduce DI/IoC programming methodology into our development group, but one of the developer asked the following question: Why do we need it? Is there any concrete example that can show me the benefit of using DI/IoC framework like windsor castle? Therefore, I am asking if there are any case study or article o...

Design - Where should objects be registered when using Windsor

I will have the following components in my application DataAccess DataAccess.Test Business Business.Test Application I was hoping to use Castle Windsor as IoC to glue the layers together but I am bit uncertain about the design of the gluing. My question is who should be responsible for registering the objects into Windsor? I have a coup...

Plugin Framework - can there be too many addin assemblies?

Hi, The product I'm working on needs to be built in such a way that we have a quote engine driven by a pluggable framework. We are currently thinking of using MAF, so we can leverage separation of the host and addin interfaces for versioning. However, I'm concerned that we'd have lots of assemblies, it's likely that we'd have one for ...

Are there any inversion of control frameworks for javascript?

Are there any inversion of control frameworks for javascript? The closest answer available on stackoverflow that I could find is here: http://stackoverflow.com/questions/619701/wiring-code-in-javascript . It looks like a great start, but I thought I'd be able to find something with a longer development history. I've only used Castle W...

Spring IoC: What about serialization?

Hi StackOverflow! I am just in the middle of the development of a new software component involving the Spring Framework. I like it but now i have a question regarding IoC and serialization. Given i have this class (Omitted imports and package declaration): public class EMailNotificationEndpoint implements NotificationEndpoint { priv...

ASP.NET MVC Using Castle Windsor IoC

I have an app, modelled on the one from Apress Pro ASP.NET MVC that uses castle windsor's IoC to instantiate the controllers with their respective repositories, and this is working fine e.g. public class ItemController : Controller { private IItemsRepository itemsRepository; public ItemController(IItemsRepository windsorItems...

Can I get a concrete type from an interface instance with Ninject?

I have contracts for functionality in my repository that are implemented with linq-to-sql. // IEvent was extracted from the generated linq-to-sql class public partial class Event : IEvent { } public class EventRepository : IEventRepository { public void Add(IEvent e) { db.Events.InsertOnSubmit(e); db.SubmitCha...

How to use dependency injection and the repository pattern with ASP.NET web services?

With regular ASP.NET MVC pages, the repository is passed in to the constructor of the control. Then the tests can instantiate the controller passing in a mock repository. How can I do this with web services? The problem I see is that we don't have the equivalent of ControllerBuilder.SetControllerFactory. What are the best practices t...

Is there a good/proper way of solving the dependency injection loop problem in the ASP.NET MVC ContactsManager tutorial?

If you don't know what I'm talking about either go through the tutorial and try to add dependency Injection yourself or try your luck with my explanation of the problem. Note: This problem isn't within the scope of the original tutorial on ASP.NET. The tutorial only suggests that the patterns used are dependency injection friendly. The...

Using IoC for UnitTesting

How can a Ioc Container be used for unit testing? Is it useful to manage mocks in a huge solution (50+ projects) using IoC? Any experiences? Any c# libraries that work well for using it in unit tests? ...

What is the best documented IOC framework for .net?

I am looking for the IOC/DI framework with the best documentation which would it be? ...

Where should I do dependency injection with Ninject 2?

I have a solution with two relevant (to this question) projects, and a few others; Class library with functionality used by several other projects. ASP.NET MVC application. My question is basically where I should do IoC with Ninject 2, considering... The class library needs some DI love, among other things in the repository classes...

Any IoC container that can build types based on interfaces?

If I register a bunch of data structures with an IoC container, I'd like to say (C# syntax): var lookup = container.Create<IDictionary<Name,ISequence<EMail>>>() ; The container should magically find the registered types that implement IDictionary and ISequence, and construct the type I need. Basically, I want to create types based on ...