现在的 nDepend 和 CQL 是否可以直接使用派生类型的类来请求类?
阅读了大量的问题和帖子,发现直到下一个版本才支持子查询/嵌套查询/查询组合。然而我不确定这是否是我需要的,在我的脑海里我会这样写,但我可能会让事情变得复杂。
我想像
WARN IF Count > 0 IN
SELECT TYPES WHERE
IsDirectlyUsing "MTNE.Web.OneWeb.^.*\p{Proxy}+$" IN
SELECT TYPES WHERE DeriveFrom "System.Web.Services.Protocols.SoapHttpClientProtocol"
所以我想做的是检查类型是否直接使用给定名称空间中具有后缀 Proxy 的其他类型,并且代理类型是否派生自 SoapHttpClientProtocol。如果类型直接使用代理类型,则会发出警告。
有建议、提示、提示、指点或答案吗?
Been reading through a lot of Q's and posts and see that subqueries/nested queries/query composition will not be supported until the next version. However I'm not sure if that is what I need, in my head it I would write it that way but I might be complicating things.
I imagine it like
WARN IF Count > 0 IN
SELECT TYPES WHERE
IsDirectlyUsing "MTNE.Web.OneWeb.^.*\p{Proxy}+$" IN
SELECT TYPES WHERE DeriveFrom "System.Web.Services.Protocols.SoapHttpClientProtocol"
So what I'd like to do is check if types are directly using other types in a given namespace which has the suffix Proxy, and that the proxy type is derived from SoapHttpClientProtocol. If a type is directly using the proxy type announce a warning.
Suggestions, hints, tips, pointers or answers anyone?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有多种方法可以编写基于 LINQ 查询的代码规则 (CQLinq) 提出的查询。当然,最优雅、简洁和优化的方法是:
注意我们如何首先定义 2 个集合,并使用扩展方法 ToHashSet() 来优化 Intersect() 方法。
另请注意方法 UsingAny( ),在一次调用中,执行大量工作。
There are several ways to write the query asked with Code Rule over LINQ Query (CQLinq). Certainly the most elegant, concise and optimized way is:
Notice how we first define 2 sets, and also use the extension method ToHashSet() to optimize the execution of the Intersect() method.
Notice also the usage of the method UsingAny() that, in a single call, perform a lot of work.