1
Vote

ResolveConstructor Exception

description

Greetings Rishi
 
I am getting an exception trying to use the Repository pattern and your Resource Locator Framework. The solution is split into 3 projects the UI app, Model (contains teh POCO objects), and the Repository which contains the various interfaces and their implementations (split into relating folders within the repository project).
 
when i try an use the dependancy injection of the resolve constructor attribute and this
[ResolveConstructor]
public Constructor(IRepository repository)
 
It throws an exception as it cannot resolve the type - is this an issue with the fact that the view model and the resource that i wish to resolves interface and implementation are not in the same project?
 
Please get back to me as i wish to be able to di this and treat my Repositories as singletons.
 
Thanks

comments

Orktane wrote Feb 7, 2011 at 11:42 PM

Well, there could a be a number of issues causing the problem (look for an inner exception with Application_UnhandledException), but if you are using WPF it could be an issue with the default behavior of .NET to lazy load assemblies - I discussed this issue with solutions here: http://nroute.codeplex.com/Thread/View.aspx?ThreadId=243949

Also in the same question you can an example of how to define services as singletons - i.e. basically set the Lifetime to be InstanceLifetime.Singleton.

Hope this helps,
Rishi

wrote Feb 14, 2013 at 8:29 PM