开发者

nhibernate virtual methods & resharper

I am curious how other Resharper users deal wih R#'s complaint about virtual metho开发者_开发问答ds it thinks are unused because it can't tell that NHIb will use them at runtime. I currently leave it as a hint, reluctantly, although am tempted to shut it off completely.

Cheers,

Berryl

example property or method where R# sees that a virtual member is never overriden

   public virtual string Hello{ get { return "Hello"; } }


Have you tried adding the UsedImplicitlyAttribute?

EDIT: This works for me at the method level to suppress "Method 'Fink' is never used":

[UsedImplicitly]
private void Fink()
{
   Console.WriteLine("Fink!");
}

Note that you can also go to ReSharper/Options/Code Inspection/Settings and add to the Generated code regions. We do that for our CodeSmith templates.


You can safely keep them as hints.

It would be nice if R# allowed different settings per project, so you could disable it for your Domain classes only.

It's important to remember R# is just a tool; don't let it do the thinking for you. If an inspection is unhelpful most of the time, just disable it (or leave it as a hint, like you did)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜