Hi
Can you please explain how the following three are different in their intent?
1) Policy Injection Application Block
2) Structure Map IoC
3) Managed Extensibility Framework
In terms of the common tasks they do, which is simpler/aligned with generics and C# 3.0 ?
Thanks
Lijo
...
I'm using Ninject to retrieve my DataContext from the kernel and I was wondering if Ninject automatically disposes the DataContext, or how he handles the dispose() behaviour. From own experiences I know disposing the datacontext is pretty important and that whenever you create a direct object of the DataContext (as in: new DataContext())...
I'm interested in knowing if there are any advantages to creating a child container for each request in a web based application?
The tech stack I'm using includes StructureMap & ASP.NET MVC, which is not particularly relevant but included as background info.
...
I've been researching Dependency Injection and Inversion of Control practices lately in an effort to improve the architecture of our application framework and I can't seem to find a good answer to this question. It's very likely that I have my terminology confused, mixed up, or that I'm just naive to the concept right now, so any links ...
Hi,
we want to use Unity for IOC.
All i've seen is the implementation that there is one global static service (let's call it the the IOCService) which holds a reference to the Unity container, which registers all interface/class combinations and every class asks that object: give me an implementation for Ithis or IThat.
Frequently i se...
I have the following component mapping in Windsor xml:
<component
id="dataSession.DbConnection"
service="System.Data.IDbConnection, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
type="System.Data.SqlClient.SqlConnection, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e08...
Suppose I have a dependency that is registered as HttpRequestScoped so there is only one instance per request. How could I resolve a dependency of the same type outside of an HttpRequest?
For example:
// Global.asax.cs Registration
builder.Register(c => new MyDataContext(connString)).As<IDatabase>().HttpRequestScoped();
_containerProvi...
I am trying to use Castle Windsor with MS Test. The test class only seems to use the default constructor. How do I configure Castle to resolve the service in the constructor?
Here is the Test Class' constructors:
private readonly IWebBrowser _browser;
public DepressionSummaryTests()
{
}
public Depress...
I'm sorry if this question has already been asked 100 times, but I'm really struggling to get it to work.
Say I have have three projects.
Core.dll
Has common interfaces
Shell.exe
Loads all modules in assembly folder.
References Core.dll
ModuleA.dll
Exports Name, Version of module.
References Core.dll
Shell.exe has a [Export...
Simply, what is the difference between HybridHttpOrThreadLocalScoped & HttpContextScoped?
...
Is there a way using IoC, MEF [Imports], or another DI solution to compose dependencies on the fly at object creation time instead of during composition time?
Here's my current thought. If you have an instance of an object that raises events, but you are not creating the object once and saving it in memory, you have to register the eve...
Hi,
I'm getting an exception calling Resolve:
KernelException: Could not instantiate custom activator
Inner Exception:
{"Constructor on type 'MyProj.MyAdapter`1[[MyProj.MyBusinessObject, MyAsm, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]' not found."}
There's definitely a public parameterless constructor there (and I've v...
I have the following code using the lightcore IoC container.
But it fails with "NUnit.Framework.AssertionException: Contained objects are equal" which indicates that the objects that should be transient, are not.
Is this a bug in lightcore, or am I doing it wrong? My German isn't good enough to read the documentation.
[Test]
public ...
I'm playing with DI (using Unity). I've learned how to do Constructor and Property injection. I have a static container exposed through a property in my Global.asax file (MvcApplication class).
I have a need for a number of different objects in my Controller. It doesn't seem right to inject these throught the constructor, partly because...
Hi
I want to develop an ASP.Net MVC application with EF4 Model First design and only generate the actual database much later, ideally at the end of the project.
Based on some of the ideas here:
http://elegantcode.com/2009/12/15/entity-framework-ef4-generic-repository-and-unit-of-work-prototype/
I want to create something like an ...
hi,
There are many IOC containers for .net out there mainly MEF, Spring.net, Castle Windsor, Unity etc. Which is the most extensible and high performant? What should one consider when choosing a particular IOC container?
Thanks in adv
...
The application I'm working on requires objects to be created on the fly, some of them also use singleton instances (lifetime manager based, of course), because there is state involved (think WCF service sessions, etc...).
As long as I resolve via the same instance of the UnityContainer class, everything is fine, but I think here the sn...
I am trying to register a type conversion in my config file as follows:
<param name="connectionString" parameterType="System.String">
<value value="MyDbConnection"
type="System.Configuration.ConnectionStringSettings"
typeConverter="ConnectionStringSettingsTypeConverter" />
</param>
I am getting the standard can't...
Hi,
I have a scenario where I have multiple classes implementing one interface.
When at runtime the resolution is done I want some rules to execute to give me back the required instance.
I am thinking of writing some extension for Unity which can accept the configurations like this:
<unity xmlns="http://schemas.microsoft.com/practices/...
Hello,
I have a MessageSender class that its constructor looks like this:
public MessageSender(IInputComponent input, IOutputComponent output)
{
m_Input = input;
m_Output = output;
}
This is how I instantiate it:
Container.RegisterType<IMessageSender, MessageSender>();
Container.RegisterType<IInpu...