开发者

nhibernate virtual methods & resharper

开发者 https://www.devze.com 2022-12-26 09:11 出处:网络
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 i

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

精彩评论

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