Say I have a nice domain model, using (constructor) DI where needed. Now I want to be able to persist this model, so I start adding infrastructure(Entity Framework) to do this. What happens now is that the persistence framework should be able to initialize your types using your IoC container.
Maybe this is possible, maybe not. Anyway, w...
I would like to use "strategy pattern" with 2 Web projects, my configuration file (and only with configuration file) :
<?xml version="1.0"?>
<configuration>
<components>
<!-- container ORM -->
<component id="DALReseauContainer" type="ReseauRules.Db.BLL.DbReseauWorkingContextContainer, ReseauRules" ...
I am dipping my toe into using a IoC framework and I have choosen to use Unity. One of the things that I still don't fully understand is how to resolve objects deeper into the application. I suspect I just haven't had the light bulb on moment that will make it clear.
So I am trying do something like the following in psuedo'ish code
voi...
I have a class which is going to need to use the strategy design pattern. At run time I am required to switch different algorithms in and out to see the effects on the performance of the application.
The class in question currently takes four parameters in the constructor, each representing an algorithm.
How using Ninject (or a general...
Consider the following:
public Something(IInterface concreteObjectOne, IInterface concreteObjectTwo)
{
this.concreteObjectOne = concreteObjectOne;
this.concreteObjectTwo = concreteObjectTwo;
}
How do I set set this type of binding up with Ninject? I'd try Googling the term, but as I'm not sure what this is...
I'm struggling to find a decent walkthrough for this issue, and was hoping that someone could shed some light on this... I've built an application using a ton of Unity and DI, and I need to pull a few components into a web site and run a WCF service now with them. host a WCF service for clients to connect to it instead of having it inclu...
Possible Duplicate:
Which C#/.NET Dependency Injection frameworks are worth looking into?
Yes I know this question has been asked many times, but the various frameworks keep evolving, so I would like a fresh answer on the subject.
A few thoughts about the framework, they are not necessary black or white, but rather my prefere...
I find that my constructors are starting to look like this:
public MyClass(Container con, SomeClass1 obj1, SomeClass2, obj2.... )
with ever increasing parameter list. Since "Container" is my dependency injection container, why can't I just do this:
public MyClass(Container con)
for every class? What are the downsides? If I do this,...
Is there any way to request an instance from the StructureMap ObjectFactory by the string name of the type? For example, it would be nice to do something like this:
var thing = ObjectFactory.GetInstance("Thing");
The use case here is a messaging scenario in which the message is very generic and contains only the name of a task. A ha...
When an object in Ninject is bound with InTransientScope(), the object isn't placed into the cache, since it's, er, transient and not scoped to anything.
When done with the object, I can call kernel.Release(obj); this passes through to the Cache where it retrieves the cached item and calls Pipeline.Deactivate using the cached entry.
...
Just trying to implement unit testing into a brownfield type system. Be aware i'm relatively new into the unit testing world. Its going to be a gradual migration of course because there are just so many areas of pain.
The current problem i'm trying to solve is we followed a lot of bad practices from our VB6 days and in the conversion...
Hi everybody!
I want to implement multi tenancy using Windsor and i don't know how to handle this situation:
i succesfully used this technique in plain ASP.NET MVC projects and thought incorporating in a RIA Services project would be similar.
So i used IHandlerSelector, registered some components and wrote an ASP.NET MVC view to verify...
Hi,
I have a "Product" base class, some other classes "ProductBookDetail","ProductDVDDetail" inherit from this class. I use a ProductService class to make operation on these classes. But, I have to do some check depending of the type (ISBN for Book, languages for DVD). I'd like to know the best way to cast "productDetail" value, I recei...
Is it possible to autowire beans using the @Autowired annotation without using component scanning?
...
Given a class with several constructors - how can I tell Resolve which constructor to use?
Consider the following example class:
public class Foo
{
public Foo() { }
public Foo(IBar bar)
{
Bar = bar;
}
public Foo(string name, IBar bar)
{
Bar = bar;
Name = name;
}
public IBar Bar ...
The idea is to use DI container on my service contract implementation to instantiate my Business and Data classes.
The reason I need to do it this way, is that I have one service contract that deals with different client requests. Each client request corresponds to different Business class
...
I'm trying to figure out how this would be done in practice, so as not to violate the Open Closed principle.
Say I have a class called HttpFileDownloader that has one function that takes a url and downloads a file returning the html as a string. This class implements an IFileDownloader interface which just has the one function. So all...
I just started using the Unity Application Block to try to decouple my classes and make it easier for unit testing. I ran into a problem though that I'm not sure how to get around. Looked through the documentation and did some Googling but I'm coming up dry. Here's the situation:
I have a facade-type class which is a chat bot. It is a s...
So my company uses Castle Windsor IoC container, but in a way that feels "off":
All the data types are registered in code, not the config file.
All data types are hard-coded to use one interface implementation. In fact, for nearly all given interfaces, there is and will only ever be one implementation.
All registered data types have a ...
So I already have a working implementation of StructureMap with the WCF service (including custom instance provider, behaviors, etc.)
When I try to have an object that is instantiated only once per user request, I use the InstanceScope.HttpContext and it throws because the context is null.
Do anyone have a proper way of doing that?
...