hmemcpy / AgentMulder

** THIS PLUGIN IS NO LONGER MAINTAINED. PLEASE FOLLOW ERNICOMMUNITY FOR UPDATES **
https://github.com/ERNICommunity/AgentMulder
MIT License
151 stars 33 forks source link

demo project fails with Unity 2.x #55

Closed draptik closed 11 years ago

draptik commented 11 years ago

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:

Thankful for any pointers,

Patrick

hmemcpy commented 11 years ago

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 $container$ is a type deriving from 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!

draptik commented 11 years ago

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