I have started a small project to properly teach myself about a number of things: domain driven development and inversion of control are the ones that apply in this case.
I have decided to write an application that can load and visualize timing data from sports events (I have access to quite a lot of this type of data).
One requireme...
I'm just trying to understand where the label 'container' came from. Anyone know?
Seems like many things could be called 'containers'.
...
(from the StockTraderRIBootstrapper.cs file in the Prism V2 StockTrader example app)
What is the difference between this:
ShellPresenter presenter = new ShellPresenter();
and this:
ShellPresenter presenter = Container.Resolve<ShellPresenter>();
I understand the second example is treating the container like a factory, walking up t...
I am using Ninject to load serveral modules. When two modules try to bind two different implementations for an interface, ninject raises an error that multiple binding for a
service are not allowed.
All other IoC frameworks I'm using (Unity, Windsor, Spring.net, etc)
all have the ability to 'register' multiple implementations for an...
I'm a Castle n00b, and am using the Fluent API in Castle Windsor to auto-register implementations to services based on a naming convention (ISomething is implemented by Something). One thing I wanted to support is for auto-registration to pick up dependencies that are in separate dlls, and auto-register those, as well.
So: IFoo is impl...
Can someone provide the XML configuration I should use with Microsoft Unity application block in the Enterprise Library 4.1 to achieve the same result as the following?
using System;
using Microsoft.Practices.Unity;
using Microsoft.Practices.Unity.InterceptionExtension;
namespace ConsoleApplication1
{
class Pr...
I have one interface with 2 classes implementing it, I need to load each class but unity has:
m_unityContainer.Resolve() // Where is the interface IGeneric
my config looks like:
<type type="IGeneric" mapTo="ClassA">
</type>
<type type="IGeneric" mapTo="ClassB">
</type>
any ideas?
thanks
...
I'm still pretty new to using Autofac and one thing I miss in the documentation and examples is how to make it easy to get to the configured container from different places in a web application.
I know I can use the Autofac controller factory to automatically resolve constructor injected dependencies for controllers, but how about the ...
I have a simple SM Registry where I am configuring all my instances of IDynamicValue. I have some contructor arguments that are non-primative types (in my case a DateTime and a Predicate Of T). Is there a way I can inject these without having to wrap them in a class with an interface (so they can be auto-wired). The following code snippe...
In Window1.xaml I have menu and display area:
<Menu x:Name="TheMenu" Width="Auto" Height="25" DockPanel.Dock="Top"/>
<ItemsControl x:Name="MainContent" DockPanel.Dock="Top"/>
In Window1.xaml.cs I dynamically load in a menu item:
MenuItem menuItemEmployees = new MenuItemEmployees(this);
TheMenu.Items.Add(menuItemEmployees);
In MenuI...
We are developing what is becoming a sizable ASP.NET MVC project and a code smell is starting to raise its head.
Every controller has 5 or more dependencies, some of these dependencies are only used for 1 of the action methods on the controller but obviously are created for every instance of the controller.
I'm struggling to think of a...
I want to redefine an (default) implementation in a given windsor-container. Is that what OverWrite is for? Doesn't work, though.
container.Register(
Component.For<IServiceOperationAuthorization>()
.OverWrite()
.Instance(_authorization)
);
...
I'd like to declare a chain of responsibility using decorators in Ninject.
Has anyone done that before?
Thanks.
...
I've read a lot about IoC and DI, but I'm not really convinced that you gain a lot by using them in most situations.
If you are writing code that needs plugable components, then yes, I see the value. But if you are not, then I question whether changing a dependancy to a class to a dependancy of an interface is really gaining you anythi...
I have a class that I want to have access to my IOC container (Windsor), however I don't want to keep a static IWindsorContainer property hanging around - I would prefer to have the container inject itself into any classes that require an IWindsorContainer as a constructor dependency.
I've pulled this off with Unity, but when I try the ...
I have been looking at the examples for updating models in the MVC architecture. There are plenty updating the model where the linq (SQL or EF) is in the controller. And there are others where the service layer is used to fetch values. The only example I can find its going to be awkward to use with an IoC container.
What I'm looking to ...
I'd like to configure the Windsor container so that a single, singleton-style instance can provide two or more services through the container.
I've found that using the same type in multiple component declarations (XML-based config) will result in an instance of that type being created to provide each component's service interface, whic...
Say I have a Task object, with an Execute method. This method has one to several steps, each of which requires a user to click a 'Continue' button, e.g. when Execute is invoked, the Task tells it's container (a Windows form in this case) to display an introductory message, and wait for a button click, before continuing with step 2, noti...
// Enrich with is enriching more than i want
public intefrace ICommand {
void Execute();
}
// classes
public class A : ICommand {}
public class B : ICommand {}
public class MultiCommand : ICommand {
public MultiCommand(ICommand[] commands) {}
}
// -- decorators
public DecoratorOne : ICommand {
public DecoratorOne(Icommand toDe...
I have IRepository<T> , and implementation SqlRepository<T>. SqlRepository has DataContext parameter in constructor.
SM configuration looks like this:
x.ForRequestedType(typeof(IRepository<>))
.TheDefaultIsConcreteType(typeof(SqlRepository<>));
x.ForRequestedType<DataContext>().CacheBy(InstanceScope.Hybrid)
.TheDefault.Is.Constructe...