RESTier
RESTier copied to clipboard
"CanXXX" method lookup skips inlined properties.
C# 7.0 shortcuts make it easy to have Restier miss the "CanXXXEntitySet" authorization methods if they were accidentally created as properties..
Assemblies affected
Microsoft.Restier.Core 1.0.0-beta1.
Reproduce steps
C# 7.0 allows you to simplify properties and methods using lambdas. That lets you turn
public bool SomeProperty { get; private set; }
into
public bool SomeProperty => DoSomething();
and
public bool DoSomething()
{
return DoSomethingElse();
}
into
public bool DoSomething() => return DoSomethingElse();
Now, the issue is, the property and method inlining are virtually the same. The only difference is in parenthesis. So it is extremely easy to mistakenly create a property when you think you're creating a method, and it is not obvious that you've made a mistake. In fact, I didn't realize it until I wrote Breakdance and it wasn't picking up my "CanXXX' methods.
Restier is magical. It should be smart enough to know the difference and do the right thing in either situation.
Expected result
I would expect that Restier would still find my methods.
Actual result
It does not.
I have a fix for this that I'd like to make a pull request for, but my other PR has yet to be accepted, and I don't want to overload it.
We should soon be to the point where we can take your PR for this.
Awesome!
I'm pretty sure I fixed this already.