Hi,
i've been using structuremap since a couple of months. I always use ObjectFactory.GetInstance to take the right instance of the object i've to use.
Actually, i need to understand which is the default ObjectFactory's InstanceScope. Is it ThreadLocal?
do u know where i can read about it?
...
Hello,
I'm building a master-detail form. The master view model constructs instances of the details view model. These details view models have several dependencies which need to be satisfied with new class instances. (This is because they need service layers that operate in a separate data context from the master vm.)
What would be the...
I am using CommonSrviceLocator with WindworContainer for resolving my NHibernage.ISession instances. ISession instances is created through SessionFactory. For some reason I need to work with different databases in one application, so I need different connection strings and different NHibernate.ISession objects.
SessionFactory can create...
I'm trying to understand which objects should be injected into an object and which should be created internally.
If i have some List<int> (as data field) which holds infomation gathered during run time. it seems that i should init it in the c'tor instead of injecting it.
but what about a hardware class which communicates through a CO...
Does anyone have any idea about what i doing wrong?
I have a such static class:
public static class ApplicationContainer
{
private static ContainerBuilder builder = null;
private static IContainer container = null;
public static void Create()
{
builder = new ContainerBuilder();
builder.RegisterInstance...
Hello again stackoverflowians,
I thought it was about time that I learnt how to use a DI framework. I've heard a lot of good things about Castle Windsor so I decided to go with that. Now there are PLENTY of tutorials out there on how to use it, however, I cannot find much useful information about what to do when Generics get involved....
Is there a way i can set AutoFac to use PropertiesAutowired(true) to be the default for all types being registered.
i.e. I dont want to use ".PropertiesAutowired(true)" all the time
var builder = new ContainerBuilder();
builder.RegisterType<Logger>()
.PropertiesAutowired(true)
.SingleInstance();
...
I'm using castle windsor in asp.net mvc 2, with a separate project for the domain model which contains datacontext (dbml), I've deleted the app.config in the domainmodel project
getting the following error:
Can't create component 'DomainModel.Concrete.ArticleRepository' as it has dependencies to be satisfied.
DomainModel.Concrete.Arti...
I am new to IOC in general and I'm struggling a little to understand whether what I am trying to do makes any sense. I have a web forms application in which I want to create one module to define some bindings for me. The bindings will be used to inject repositories into my business manager classes, allowing me to unit test the business...
I am fairly familiar with Autofac and one feature that I really love about Autofac is the registering of modules. Does anyone know how I can do this with Unity? I'm having a hard time finding which terms to use in Google to come up with the unity equivalent if there is one.
public class Global : HttpApplication, IContainerProviderAc...
Sorry, this is quite a special topic so this may not be of interest to many. :-(
However, I need to do the following thing:
I have an application that provides logging to some kind of console window (it's a WPF window, because of application requirements and because the application needs to look flashy even here - our special customer...
How can I use my IoC container in a DataService and the CurrentDataSource inside for WCF Data Services? I have several services I want to pass into it. The "host" application or project for the DataService is based on ASP.NET MVC 2.0. My IoC container is setup in the MvcApplication.
...
Hello,
I'm using MEF to create several instances of the same export.
I'd like to keep track of the instances I have created, and am either querying the container or using a recomposited collection, but I never get my instances...
Here's the code:
interface IFoo{};
[Export(typeof(IFoo)),PartCreationPolicy(CreationPolicy.NonShared)]
cl...
I'm trying to run the following code with Ninject.Moq:
[TestMethod]
public void TestMethod1()
{
var kernel = new MockingKernel();
var engine = kernel.Get<ABC>();
//as I don't need to actually use the interfaces, I don't want
//to even have to bother about them.
Assert.AreEqual<string>("abc", engine.ToString());
}
A...
I currently have a class of this form:
class Abc {
private readonly IDisposable disposable;
public Abc(IDisposable disposable) {
this.disposable = disposable;
}
...
}
Now, I'd like to know how can I make a binding of IDisposable to Bitmap using the
Bitmap(int widht, int height)
constructor.
I've tried w...
Hi. I've ran into a rather hairy problem. There is probably a simple solution to this but I can't find it!
I have a custom HttpHandler that I want to process a request, log certain info then enter the details in the database. I'm using NUnit and Castle Windsor.
So I have two interfaces; one for logging the other for data entry, which a...
Hi all,
Say I have a component like this
public class MyComponent
{
public MyComponent(string name)
{
}
}
I basically want to have the provided constructor parameters behave as part of the component identifier when resolving it. If you've never resolved it with that set of parameters, it will instantiate a new one.
In ot...
I am looking for an example of how to configure an ASP.NET MVC2 project to use CastleWindsor container to do IoC.
I keep running into problems setting it up, and for every problem there seems to be a solution on-line, but in the end I make so many changes and end up with such a verbose setup to get IoC working using CastleWindsor, that ...
How IOC container helps maintaing objects by creating once and injecting when required???
...
With ASP.NET MVC it is pretty easy to integrate an IoC container to create the controllers.
Is the same thing also possible with webforms to create the pages and controls and pass them any dependencies? If yes, where do I have to plug it in?
...