1
голосов
1ответов
465 просмотров

Prefer Dependency-Injection over Partial Mocking?

I know this SO question, but it deals with the subject in more general terms. Should I prefer using partial Mocks over Dependency Injection? My question is based on the following quote from OCMock: id aMock = [OCMockObject partialMockForObject:anObject] Creates a mock object that can be us...

19
голосов
1ответов
5281 просмотров

List all types registered with a Castle Windsor container instance

What's the easiest way of programatically listing registered types in Castle Windsor? Thanks

6
голосов
3ответов
401 просмотров

Can inversion of control and RAII play together?

I was just reading up on inversion of control (IOC) and it bothered me that it seems like it makes memory management a pain. Of course it seems ioc is mostly used in garbage collected environments (Net,Java,Scripting), while my concern is in non-gc settings. My concern here is that IOC in a way ...

7
голосов
2ответов
412 просмотров

Dependency injection in NerdDinner - actually testing your repository or model

Consider a beginner dealing with Dependency Injection. We're analyzing two relevant classes in NerdDinner. DinnerRepository from the application: FakeDinnerRepository from the tests: They implement different logic, which of course is necessary, as the key idea here is to implement the IDinne...

8
голосов
3ответов
2463 просмотров

What performance overhead do IoC containers involve?

Loose coupling is wonderful of course, but I have often wondered what overhead wiring up dynamically using an IoC container (for example Castle Windsor) has over a tightly coupled system? I know that a detailed answer would depend on what the IoC was being used for, but I'm really just trying to...

1
голосов
1ответов
151 просмотров

Can you do conventions-based binding with StructureMap 2.5.3?

I find one of the best features of Ninject is conventions-based binding. eg. Bind<IConfigurationSource>().To<RemoteConfigurationSource>() .Only(When.Context.Target.Name.BeginsWith("remote")); Bind<IConfigurationSource>().To<LocalConfigurationSource>() .Only(When.Context....

0
голосов
1ответов
1204 просмотров

Structure map and generics (in XML config)

I'm using the latest StructureMap (2.5.4.264), and I need to define some instances in the xml configuration for StructureMap using generics. However I get the following 103 error: Unhandled Exception: StructureMap.Exceptions.StructureMapConfigurationException: StructureMap configuration failure...

2
голосов
6ответов
1336 просмотров

small footprint dependency injection java

I am looking for a very lightweight dependency injection framework for java. With minimum possible dependencies and minimum features. Just something along the following lines: receive a java.util.List of Classes, instantiate them and just auto-wire all the objects one into the other.

0
голосов
4ответов
217 просмотров

Don’t know enough to know if this design is a great idea or an incredibly dumb one …

Using C#, asp.net 3.5, SqlServer 2005, Trying to incorporate some inversion of control together with 3-tier architecture into my current assignment. Don’t know enough to know if this is a great idea or an incredibly dumb one: I have created a User Interface Layer, a Business Layer, and a Data...

6
голосов
2ответов
6673 просмотров

spring: a bean that receives a list of Classes

I want to define in my Spring XML context a bean that has a property of the type List of classes: i.e. List<Class<?>> classes How do I send that bean a number of classes, say java.lang.String and java.lang.Integer? The list needs not be reusable, i.e. I will not refer to it in anoth...

1
голосов
2ответов
1194 просмотров

Castle Windsor (or other DI) - creating object based on parameter

I am pretty new to the whole DI/IoC thing, so bear with me... I have this kind of setting: interface IA interface IB interface IC abstract class A : IA class B : A, IB class C : A, IC interface IX interface IY interface IZ abstract class X : IX class Y : X, IY class Z : X, IZ B and C's const...

20
голосов
4ответов
1721 просмотров

Dependency Injection as a Language Feature?

Are there any existing modern-day programming languages that explicitly have dependency injection as a language feature, and if so, are there any examples of how such programming languages use their syntax to separate program dependencies from their concrete implementations? (Please Note: I'm no...

2
голосов
1ответов
293 просмотров

Linq to SQL & Castle IoC Container sanity check please

I've just started using both Linq to SQL and Windsor Castle IoC container for a new web app and, although things seem to be working OK in preliminary tests, I could really do with a sanity check on it. I was running into problems when I tried to pull objects out of the database using Linq in dif...

151
голосов
14ответов
31618 просмотров

Dependency injection through constructors or property setters?

I'm refactoring a class and adding a new dependency to it. The class is currently taking its existing dependencies in the constructor. So for consistency, I add the parameter to the constructor. Of course, there are a few subclasses plus even more for unit tests, so now I am playing the game of g...

48
голосов
5ответов
2720 просмотров

How to avoid anemic domain models, or when to move methods from the entities into services

I have a common scenario that I am looking for some guidance from people more experienced with DDD and Domain Modeling in general. Say I start out building a blog engine, and the first requirement is that after an Article is posted, users can start posting Comments on it. This starts fine, and l...

1
голосов
1ответов
546 просмотров

NHibernate conversation with ASP.NET+IoC+PostSharp?

Does anybody know a good example of how an NHibernate conversation can be used in a Web context (ASP.NET or ASP.NET MVC) using an IoC container and AOP? Personally, I use Castle/Windsor and PostSharp, but I will appreciate everything that points me to the right direction.

7
голосов
3ответов
6034 просмотров

IoC container for Objective-C

Possible Duplicate: Dependency injection framework for Cocoa? Is there any IoC container for Objective-C?

0
голосов
3ответов
137 просмотров

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 ...

39
голосов
1ответов
10459 просмотров

Where should I do Injection with Ninject 2+ (and how do I arrange my Modules?)

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, am...

3
голосов
6ответов
1082 просмотров

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?

97
голосов
4ответов
41143 просмотров

Using IoC for Unit Testing

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?

22
голосов
3ответов
5893 просмотров

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 us...

7
голосов
6ответов
3683 просмотров

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.SetControl...

2
голосов
2ответов
2256 просмотров

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 It...

4
голосов
2ответов
3615 просмотров

Spring IoC: What about serialization?

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 Notif...

16
голосов
12ответов
7443 просмотров

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: What is the right way to wire together 2 javascript objects? . It looks like a great start, but I thought I'd be able to find something with a longer developmen...

0
голосов
1ответов
421 просмотров

Plugin Framework - can there be too many addin assemblies?

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...

49
голосов
2ответов
12615 просмотров

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 regis...

7
голосов
2ответов
469 просмотров

Help getting DI/IoC in house

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 ther...

0
голосов
2ответов
84 просмотров

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 ...