Tell Resharper to use spring.net DI configuration for the inspection of unused classes?
Resharper warns me when parts of my code are never used; this is very helpful.
However, I have quite a few classes that are not referenced by other code directly. These classes are used in the dependency injection (DI) configuration only.
I use spring.net for DI. The DI configuration is in xml format.
Is there any way I can tell Resharper to use the DI files for the 开发者_如何转开发inspection of unused classes?
I know I can suppress the Resharper warning using something like:
// ReSharper disable UnusedMember.Global
public class TheClass : IInterfaceWiredUsingSpringDI
// ReSharper restore UnusedMember.Global
But I don't like this very much - it's difficult to read and I don't really want to suppress the warning.
Note:
There is a less obtrusive and more readable way to suppress the warning, which I found on the jetbrains forum. When you define this custom attribute:
[MeansImplicitUse]
public class IoCAttribute : Attribute { }
Then you can suppress the warning:
[IoC]
public class TheClass : IInterfaceWiredUsingSpringDI
I'm 3 years too late to answer this, but I just saw this question via ReSharper's twitter stream. I created a plugin for ReSharper called Agent Mulder, and it does exactly this -- analyzes IoC container registrations, and allows navigating and finding usages of types that are registered via the container!
For the list of supported containers, please visit the project's wiki on github.
(Unfortunately, it doesn't work with Spring.NET, since there was no demand for it, sorry :))
I don't believe so. Spent a bit of time trying to solve a similar frustration with IOC and ReSharper to no avail, just doesn't facilitate it as far as I can tell.
精彩评论