2013-07-08 1 views

ответ

0

Запрос на который:

// <Name>Not my code, methods tagged with GeneratedCodeAttribute</Name> 
notmycode from t in Application.Types 
where t.HasAttribute ("System.CodeDom.Compiler.GeneratedCodeAttribute".AllowNoMatch()) 
select t 

Обратите внимание, что default notmycode query for types уже учитывающие методы маркированный GeneratedCodeAttribute ,

// <Name>Discard generated Types from JustMyCode</Name> 
// --- Make sure to make this query richer to discard generated types from NDepend rules results --- 
notmycode 
from t in Application.Types where 

    // Resources, Settings, or typed DataSet generated types for example, are tagged with this attribute 
    t.HasAttribute ("System.CodeDom.Compiler.GeneratedCodeAttribute".AllowNoMatch()) || 

    // This attributes identifies a type or member that is not part of the user code for an application. 
    t.HasAttribute ("System.Diagnostics.DebuggerNonUserCodeAttribute".AllowNoMatch()) || 

    // Delegate types are always generated 
    t.IsDelegate || 

    // Discard ASP.NET page types generated by aspnet_compiler.exe 
    // See: http://www.ndepend.com/FAQ.aspx#ASPNET 
    t.ParentNamespace.Name.EqualsAny("ASP", "__ASP") || 

    // Discard generated type ContractException 
    t.Name == "__ContractsRuntime+ContractException" || 
    t.FullName == "System.Diagnostics.Contracts.RuntimeContractsAttribute" || 
    t.FullName == "System.Diagnostics.Contracts.__ContractsRuntime" || 

    // Discard all types declared in a folder path containing the word "generated" 
    (t.SourceFileDeclAvailable && 
    t.SourceDecls.All(s => s.SourceFile.FilePath.ParentDirectoryPath.ToString().ToLower().Contains("generated"))) 

select new { t, t.NbILInstructions } 

 Смежные вопросы

  • Нет связанных вопросов^_^