nuget-extensions/nuget-commands/src.2.8/QueryBuilder.cs [10:40]: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - public static class QueryBuilder { [NotNull] public static Expression GenerateQuery(PackageFetchOption fetchOption, IEnumerable ids, ParameterExpression param) { var idFilter = GeneratePackageIdFilter(ids, param); switch (fetchOption) { case PackageFetchOption.IncludeAll: return idFilter; case PackageFetchOption.IncludeLatest: { var pi = typeof(IPackage).GetProperty("IsLatestVersion"); if (pi == null) goto case PackageFetchOption.IncludeAll; return Expression.And(Expression.Property(param, pi), idFilter); } case PackageFetchOption.IncludeLatestAndPrerelease: { var pi = typeof(IPackage).GetProperty("IsAbsoluteLatestVersion"); if (pi == null) goto case PackageFetchOption.IncludeAll; return Expression.And(Expression.Property(param, pi), idFilter); } default: throw new Exception("Unexpected PackageFetchOption: " + fetchOption); } } [NotNull] public static Expression GeneratePackageIdFilter(IEnumerable ids, ParameterExpression param) { var toLower = typeof (string).GetMethod("ToLower", new Type[0]); - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - nuget-extensions/nuget-commands/src/QueryBuilder.cs [10:40]: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - public static class QueryBuilder { [NotNull] public static Expression GenerateQuery(PackageFetchOption fetchOption, IEnumerable ids, ParameterExpression param) { var idFilter = GeneratePackageIdFilter(ids, param); switch (fetchOption) { case PackageFetchOption.IncludeAll: return idFilter; case PackageFetchOption.IncludeLatest: { var pi = typeof(IPackage).GetProperty("IsLatestVersion"); if (pi == null) goto case PackageFetchOption.IncludeAll; return Expression.And(Expression.Property(param, pi), idFilter); } case PackageFetchOption.IncludeLatestAndPrerelease: { var pi = typeof(IPackage).GetProperty("IsAbsoluteLatestVersion"); if (pi == null) goto case PackageFetchOption.IncludeAll; return Expression.And(Expression.Property(param, pi), idFilter); } default: throw new Exception("Unexpected PackageFetchOption: " + fetchOption); } } [NotNull] public static Expression GeneratePackageIdFilter(IEnumerable ids, ParameterExpression param) { var toLower = typeof (string).GetMethod("ToLower", new Type[0]); - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -