demo project fails with Unity 2.x
Closed this issue · 2 comments
Hi,
I tried using AgentMulder for a small demo project with Unity 2.x and the plugin does not work. Here is an example image showing the Class X is never instantiated' warning
:
https://github.com/draptik/mulder-unity-testcase/blob/master/Molder_Fail.PNG
The demo project can be found here:
https://github.com/draptik/mulder-unity-testcase
Versions:
- VS 2010
- R# 7.1.3
- Agent Mulder 1.0.5.0
- Unity 2.1.505
- Project Type: .NET 4.0, ASP.NET
Thankful for any pointers,
Patrick
Hello,
Thank you very much for the report.
Unfortunately, the way Agent Mulder works, is by utilizing ReSharper's SSR (Structural Search and Replace), where it attempts to find exact patterns, e.g. $container$.RegisterType<$interface$, $concrete$>()
, where IUnityContainer
(in this case).
What you have is a wrapper of sorts over Unity, so Agent Mulder can't currently match the signature of your ServiceLocator.
I've thought about this problem, and have an idea in mind how to solve it, but unfortunately, at the moment, Agent Mulder works on exact, concrete registrations, e.g. container.RegisterType<IRepository, CustomerRepository>(...)
But thank you any way for the repro and the bug report! I'll add this to the immediate backlog, and will try to solve it!
Thanks for your quick response!
Your reasoning makes sense.
The additional abstraction layer ('ServiceLocator') in my example is not unusual.
I'll be watching the progress on this plugin ;-)
Regards,
Patrick