I have a httpHandler and using Unity 2 I would like to inject a dependency into my HttpHandler.
My code looks like:
public class MyHandler : BaseHandler
{
public MyHandler()
{
}
public IConfigurationManager Configuration
{
get;
set;
}
...
}
Using the web.config I would configure it like...
I want to use Enterprise Library 5 and Unity to intercept calls made on some WCF Data Services. If I wanted to do this on a custom object I would have an IMyObject interface and a MyObject implementation. I would then include some config in my web.config along the lines of the following (I want to add performance counters in this instanc...
Does anyone have any good examples of how to make Unity 1.2 or 2.0 work with ASP.NET WebForms?
I thought I had this figured out, but evidently I'm missing something. Now I'm getting the error; "No parameterless constructor defined for this object". I remember getting this error a couple years ago, I and just don't remember what I di...
Hi there,
I develop an application using WPF with MVVM pattern and Prism. The views are added to the ModuleCatalog and the viewmodels are registered to a unity container. For that I'm using a Bootstrapper which is responsible creating the shell, configuring the unity container and the module catalog.
The question is now, how injecting m...
I'm having a difficult time registering my types for Unity 2 in my unit tests.
Here's a snippet of the class under test:
public class SomeService : ISomeService
{
private int SomeVar { get; set; }
[Dependency]
public ISessionManager SessionManager { get; set; }
public SomeService()
{
SomeVar = SessionManag...
Hi there,
So here's my factory method which takes a parameter...
container.RegisterInstance<Func<IProductInstance, IQuantityModifier[]>>(
instance => container.Resolve<IQuantityModifier[]>());
Now one of the items returned by the array takes the IProductInsance parameter in its constructor. I can't figure out ...
Using a Unity 2.0 xml file, I am trying to populate an object that contains a generic list. According to the Unity Configuration Schema, the array element is only supported. Has anyone ever tried to use unity to populate a generic list?
...
Hi Friends, I'm developing an web application with asp.net mvc 2, and I'm using NHibernate (session per request) and Unity (for dependency injection).
In my Global.asax I'm managing my ISession something like this:
public override void Init()
{
base.Init();
BeginRequest += OpenNHibernateSession;
EndRequest += DisposeNHiber...
I was using a ServiceLocator which i was DIing with Unity
public ServiceLocator(IUserStore userStore, IProdcutsStore productsStore, ...etc) {}
public IUserStore UserStore
{
get { return userStore; }
}
This all worked fine, but I wanted lazy instantiation of the repositories as they have quite sparse use.
So my ServiceLocator n...
I am trying to abstract out the route registraion process out of global.asax into a bootstrapper. My class looks like:
public class RegisterRoutes : IBootstrapperTask
{
private readonly RouteCollection routes;
public RegisterRoutes(RouteCollection routes)
{
this.routes = routes;
}
public RegisterRoutes() : ...
Hi, could anyone give me a good example of using rhino mocks, nunit, and unity together. I am reading the help on each but there doesnt seem to be any good sample projects of how you would use them together and the way to set up projects /test projects using them. I.e. do you create new ioc containers in your test project which point t...
Hi.
I am using the Unity fluent API to inject property values on an object. My program obtains the value of the properties from an external configuration source, an xml file.
The problem I am facing is that the property I am attempting to set is of type Int32, but the value, having been read from an xml file, is initially cast as a str...
I'm trying to inject a dependency to my MVC controllers like this
private static void RegisterContainer(IUnityContainer container)
{
container
.RegisterType<IUserService, UserService>()
.RegisterType<IFacebookService, FacebookService>();
}
The UserService class has a constructor like this...
public Use...
Why should I prefer StructureMap over Unity?
...
Right then, I've run into a situation using Unity that I don't know how to solve/approach...Here's my problem.
I'm developing a WPF application and I'm using MVVM (Prism Implimentation hence the Unity container). I have a ViewModel called MenuItemsViewModel (plural) which contains an IEnumerable of MenuItemViewModel (singular). In the...
I'm trying to spawn a number of CharacterControllers and have them move around an area, but they keep getting stuck on each other. Is there a way to make them pass through each other while still respecting the terrain's obstructions?
...
I'm attempted to convert the WPF Starter Kit from C# to VB.net and I'm doing really well, except for one area... Dependency Injection using the Unity Application Block.
I have the following C# code block:
Type viewModelType = viewModelAssembly.GetType(action.ViewModelTypeName);
var notificationPolicy = unity...
How to use single component for multiple services in Unity Framework?
In Windsor it is configured in the following way:
var container = new WindsorContainer();
container.Register(Component.For<Service1, Service2>()
.ImplementedBy<Component>());
var service1 = container.Resolve<Service1>();
var service2 = co...
hi guys,
i'm trying to use unity to resolve an generic instance of the IChannelFactory<ISomeType> to create channels to a service i have written.
The problem is that the concrete version of this class ChannelFactory<ISomeType> takes the concrete type System.ServiceModel.Channels.Binding as a parameter.
My first problem was that it c...
Can someone direct me to a good example of Unity Dependency Injection for WCF services?
Any blog or msdn article will also help.
...