Resharper with StructureMap

Hi

In my structure map bootstrapper I have the following:

  x.For(typeof (IUnitOfWork<>))
                                                 .Use(typeof (UnitOfWork<>))
                                                 .CtorDependency<string>("connectionString").Is(atrbeConnectionString);

Resharper reports that constructor UnitOfWork(string connectionString) is never used.



For the following:

For<IPrincipal>().Singleton().Use<AccessSecurityPrincipal>();


Resharper reports that Class AccessSecutiryPrincipal is never instantiated.

This is true of all version of R# I've used.

Regards
Jeremy

1 comment

Hello Jeremy,

This happens because ReSharper doesn't know that UnitOfWork and AccessSecurityPrincipal
are being used implicitly. In order to avoid those warnings, you can mark
such types with attribute. In order to get the implementation
of that attribute, open ReSharper | Options | Code Inspection | Code Annotations,
press 'Copy default implementation to clipboard' and then paste the implementation
into some source file in your solution.

Andrey Serebryansky
Senior Support Engineer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

Hi

In my structure map bootstrapper I have the following:

x.For(typeof (IUnitOfWork<>))
.Use(typeof
(UnitOfWork<>))

.CtorDependency<string>("connectionString").Is(atrbeConnectionString);
Resharper reports that constructor UnitOfWork(string connectionString)
is never used.

For the following:
x.For<IPrincipal>().Singleton().Use<AccessSecurityPrincipal>();
Resharper reports that Class AccessSecutiryPrincipal is never
instantiated.

This is true of all version of R# I've used.

Regards
Jeremy
---
Original message URL:
http://devnet.jetbrains.net/message/5297180#5297180



0

Please sign in to leave a comment.