Let me clear with my Question, I have say 100 classes all these 100 classes implements 1 interface say IDependency, say suppose my classname is Customer it implements IDependency
public class Customer : IDependency
public class Order:IDependency
it goes on till 100 classes
And I am registering this class in web.config like
<type typ...
I'm working on an ASP.Net website along with a supporting Class Library for my Business Logic, Data Access code, etc.
I'm EXTREMELY new and unfamiliar with the Unity Framework and Dependency Injection as a whole. However, I've managed to get it working by following the source code for the ASP.NET 3.5 Portal Starter Kit on codeplex. But ...
I'm using the MS Unity container to do dependency injection, but a "Resolve" is returning unexpected results.
Is there an way I can debug this resolution? It would be great if I could view what Types/Instances are registered in the container, but I can't see where this is stored when using QuickWatch. It would also be useful if I could ...
Hi, i'm trying to use the Physics.Raycast method, but I get errors saying:The best overloaded method match for 'UnityEngine.Physics.Raycast(UnityEngine.Vector3, UnityEngine.Vector3, float, int)' has some invalid arguments.
It's strange because both itellisense and the documentation tell me that this is permitted:
RaycastHit hit = new R...
I'm registering few modules in my Prism application using UnityBootstrapper
protected override IModuleCatalog GetModuleCatalog()
{
var catalog = new ModuleCatalog();
catalog
.AddModule(typeof(LoginModule))
.AddModule(typeof(AppModule))
.AddModule(typeof(DataTransformationModule), InitializationMode.OnDemand)...
Why doesn't DoIt() method call get intercepted? Should I use something other than InterfaceInterceptor to intercept the DoIt() method? How would you do it?
using System;
using Microsoft.Practices.Unity;
using Microsoft.Practices.Unity.InterceptionExtension;
namespace UnityTest
{
class Program
{
static void Main(string[] ar...
I'm starting a new Silverlight project at the moment, and I'm having issues where by Unity is throwing an exception if my ViewModel (which it is instantiating for me) contains the RaisePropertyChanged event.
I looks like this:
public class AddNewClientViewModel : ViewModelBase {
private Visibility _extraClientFieldsVisible;
pu...
Hi there,
I am trying to use unity to automatically inject a datacontext on my repository using a new instance each time.., my idea is the ensure that each time a new datacontext is injected
Currently its failing on creating the repository, i think it can't resolve MyDataContext
Before creating a constructor on "the repository" (see b...
Hi there,
Previously i managed to setup my unity to provide a new DataContext each time to my Repository project. It works great.
But for example, I am in a WCF method which opens up 2 services which in turn opens up 2 repositories (repository pattern).. i was hoping to be able to reuse the same datacontext within the same wcf method....
Hi, I am registering some wrapers over un-managed objects in container. How can I dispose of them at the end of the container's lifetime? Please bear in mind I have an XML Web service.
...
I am finally getting my feet wet with Dependency Injection (long overdue); I got started playing with Unity and run into an issue with the strategy pattern. I can use the container to return to me specific implementations of a strategy based on a name, but what I don't see is how I am supposed to get the right strategy in the context.
Le...
Can someone explain to me what is the purpose of the Unity Application Block? I tried looking through the documentation but its all very abstract.
What are some practical uses for the Unity block?
...
Our project is using constructor-based Dependency Injection (we're using Unity as our container) and we have a number of constructors which have acquired a large number of parameters.
For example:
public FooRequestService(
ITransactionDataBuilder transactionDataBuilder,
IMapper<SaveFooRequest, FooRequestMessage> sav...
I'm looking for some examples on how to do the following Mock Tests using StructureMap or Unity with NUnit.
I have the following code structure
public interface IDAL
{
List<Model> Method1(int id);
}
public class DAL : IDAL
{
public List<Model> Method1(int id)
{
List<Model> retval = new List<Model>();
DbComman...
I'm starting out with MVVM, and I'm starting to understand things. I'm currently experimenting with the Cinch framework, though I'm not committed to it as of yet.
I was injecting the ViewModels into the Views using by having a reference to the ViewModel in the codebehind of the view, with the property having a [Dependency] on it, and in ...
I have setup unity in my project and it is working for objects that don't have constructor injection implemented on them. The issue is now I do have an object which requires a custom object as a constructor argument. I have set up the config below, and this errors telling me that
"TypeConverter cannot convert from System.String"
<unit...
Hi, I'm refactoring the controllers in a .net MVC app so I can inject the dependencies using the unity container. There's this service that needs a reference to the controller's modelstate so I'm hitting a roadblock here. Is it possible to get a reference to the controllers's modelstate at the time of the injection? I'm currently registe...
I'm wondering how I should store/reference my dependency injection container(s). Is it alright to have a container be a static property on a static class? Or should I have the container be an instance variable on the application? I'm wondering what the pros and cons of each option are, and what is the best practice for this in web, mvc, ...
Possibly a stupid question, but during debug I simply want to see the types that have been registered with my Unity container. I have tried going through the container in the watch window, but can't seem to find what I am looking for? I am expecting there to be a list of registered types somewhere?
Thanks in advance
...
Hi,
I have often times wondered about it but now that I have encountered a piece of logic that incorporates it, I thought I should go ahead and get some help on deciphering the fundamentals. The problem is as follows, I am looking at a WPF application that is utilizing the Composite Application Library. Within the source of the applicat...