using System.Collections.Generic;
using CTA.FeatureDetection.Common.Models;
namespace CTA.FeatureDetection.ProjectType.Extensions
{
public static class FeatureDetectionResultQueries
{
///
/// Queries a FeatureDetectionResult object to determine if the project is a .NET Core WebAPI project
///
/// Result from feature detection
/// Whether or not the project is a .NET Core WebAPI project
public static bool IsCoreWebApiProject(this FeatureDetectionResult featureDetectionResult)
{
return featureDetectionResult.FeatureStatus.GetValueOrDefault(Constants.AspNetCoreWebApiFeatureName, false);
}
///
/// Queries a FeatureDetectionResult object to determine if the project is a .NET Core MVC project
///
/// Result from feature detection
/// Whether or not the project is a .NET Core MVC project
public static bool IsCoreMvcProject(this FeatureDetectionResult featureDetectionResult)
{
return featureDetectionResult.FeatureStatus.GetValueOrDefault(Constants.AspNetCoreMvcFeatureName, false);
}
///
/// Queries a FeatureDetectionResult object to determine if the project is a .NET Framework WebAPI project
///
/// Result from feature detection
/// Whether or not the project is a .NET Framework WebAPI project
public static bool IsWebApiProject(this FeatureDetectionResult featureDetectionResult)
{
return featureDetectionResult.FeatureStatus.GetValueOrDefault(Constants.AspNetWebApiFeatureName, false);
}
///
/// Queries a FeatureDetectionResult object to determine if the project is a .NET Framework MVC project
///
/// Result from feature detection
/// Whether or not the project is a .NET Framework MVC project
public static bool IsMvcProject(this FeatureDetectionResult featureDetectionResult)
{
return featureDetectionResult.FeatureStatus.GetValueOrDefault(Constants.AspNetMvcFeatureName, false);
}
///
/// Queries a FeatureDetectionResult object to determine if the project is a WebAPI and MVC project
///
/// Result from feature detection
/// Whether or not the project is a WebAPI and MVC project
public static bool IsWebApiAndMvcProject(this FeatureDetectionResult featureDetectionResult)
{
return IsWebApiProject(featureDetectionResult) && IsMvcProject(featureDetectionResult);
}
///
/// Queries a FeatureDetectionResult object to determine if the project is a WebAPI project only
///
/// Result from feature detection
/// Whether or not the project is a WebAPI project only
public static bool IsWebApiProjectOnly(this FeatureDetectionResult featureDetectionResult)
{
return IsWebApiProject(featureDetectionResult) && !IsMvcProject(featureDetectionResult);
}
///
/// Queries a FeatureDetectionResult object to determine if the project is a Web class library
///
/// Result from feature detection
/// Whether or not the project is a Web class library
public static bool IsWebClassLibrary(this FeatureDetectionResult featureDetectionResult)
{
return featureDetectionResult.FeatureStatus.GetValueOrDefault(Constants.WebClassLibraryFeatureName, false);
}
///
/// Queries a FeatureDetectionResult object to determine if the project is a WCF Config based Service Project.
///
/// Result from feature detection
/// Whether or not the project is a WCF Config Based Service Project
public static bool IsWCFServiceConfigBasedProject(this FeatureDetectionResult featureDetectionResult)
{
return featureDetectionResult.FeatureStatus.GetValueOrDefault(Constants.WCFServiceConfigFeatureName, false);
}
///
/// Queries a FeatureDetectionResult object to determine if the project is a WCF Code based Service Project.
///
/// Result from feature detection
/// Whether or not the project is a WCF Code Based Service Project
public static bool IsWCFServiceCodeBasedProject(this FeatureDetectionResult featureDetectionResult)
{
return featureDetectionResult.FeatureStatus.GetValueOrDefault(Constants.WCFServiceCodeFeatureName, false);
}
///
/// Queries a FeatureDetectionResult object to determine if the project is a WCF Client Project.
///
/// Result from feature detection
/// Whether or not the project is a WCF Client Project
public static bool IsWCFClientProject(this FeatureDetectionResult featureDetectionResult)
{
return featureDetectionResult.FeatureStatus.GetValueOrDefault(Constants.WCFClientFeatureName, false);
}
///
///
/// Queries a FeatureDetectionResult object to determine if the project has a ServiceHost Reference, by checking
/// if project Type is WCFServiceHost.
///
///
///
public static bool HasServiceHostReference(this FeatureDetectionResult featureDetectionResult)
{
return featureDetectionResult.FeatureStatus.GetValueOrDefault(Constants.WCFServiceHostFeatureName, false);
}
///
/// Queries a FeatureDetectionResult object to determine if the project is a .NET Framework WebForms project
///
/// Result from feature detection
/// Whether or not the project is a .NET Framework WebForms project
public static bool IsAspNetWebFormsProject(this FeatureDetectionResult featureDetectionResult)
{
return featureDetectionResult.FeatureStatus.GetValueOrDefault(Constants.AspNetWebFormsFeatureName, false);
}
///
/// Queries a FeatureDetectionResult object to determine if the project is a VB .NET Framework WebForms project
///
/// Result from feature detection
/// Whether or not the project is a VB .NET Framework WebForms project
public static bool IsVBWebFormsProject(this FeatureDetectionResult featureDetectionResult)
{
return featureDetectionResult.FeatureStatus.GetValueOrDefault(Constants.VBWebFormsFeatureName, false);
}
///
/// Queries a FeatureDetectionResult object to determine if the project is a VB .NET Mvc Framework project
///
/// Result from feature detection
/// Whether or not the project is a VB .NET Mvc Framework project
public static bool IsVBNetMvcProject(this FeatureDetectionResult featureDetectionResult)
{
return featureDetectionResult.FeatureStatus.GetValueOrDefault(Constants.VBNetMvcFeatureName, false);
}
///
/// Queries a FeatureDetectionResult object to determine if the project is a VB class library Framework project
///
/// Result from feature detection
/// Whether or not the project is a VB class library Framework project
public static bool IsVBClassLibraryProject(this FeatureDetectionResult featureDetectionResult)
{
return featureDetectionResult.FeatureStatus.GetValueOrDefault(Constants.VBClassLibraryFeatureName, false);
}
///
/// Queries a FeatureDetectionResult object to determine if the project is a VB web api Framework project
///
/// Result from feature detection
/// Whether or not the project is a VB web api Framework project
public static bool IsVBWebApiProject(this FeatureDetectionResult featureDetectionResult)
{
return featureDetectionResult.FeatureStatus.GetValueOrDefault(Constants.VBWebApiFeatureName, false);
}
}
}