summaryrefslogtreecommitdiff
path: root/Codemerx/Gestor.Infrastructure/Gestor.Infrastructure.Helpers/QueryableHelper.cs
blob: 1848882bc1848795bb6fd9d87636e81be0dcf52b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using System;
using System.Linq;
using System.Linq.Expressions;
using System.Runtime.CompilerServices;

namespace Gestor.Infrastructure.Helpers
{
	public static class QueryableHelper
	{
		public static IQueryable<TSource> WhereNotEmpty<TSource, T>(this IQueryable<TSource> source, T compareVaue, Expression<Func<TSource, bool>> predicateIf, Expression<Func<TSource, bool>> predicateElse = null)
		{
			// 
			// Current member / type: System.Linq.IQueryable`1<TSource> Gestor.Infrastructure.Helpers.QueryableHelper::WhereNotEmpty(System.Linq.IQueryable`1<TSource>,T,System.Linq.Expressions.Expression`1<System.Func`2<TSource,System.Boolean>>,System.Linq.Expressions.Expression`1<System.Func`2<TSource,System.Boolean>>)
			// File path: C:\AggerSeguros\Lib\Gestor.Infrastructure.dll
			// 
			// Product version: 0.0.0.0
			// Exception in: System.Linq.IQueryable<TSource> WhereNotEmpty(System.Linq.IQueryable<TSource>,T,System.Linq.Expressions.Expression<System.Func<TSource,System.Boolean>>,System.Linq.Expressions.Expression<System.Func<TSource,System.Boolean>>)
			// 
			// Managed pointer usage not in SSA
			//    at Telerik.JustDecompiler.Steps.ManagedPointersRemovalStep.CheckForAssignment(BinaryExpression node) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Steps\ManagedPointersRemovalStep.cs:line 100
			//    at Telerik.JustDecompiler.Steps.ManagedPointersRemovalStep.VisitBinaryExpression(BinaryExpression node) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Steps\ManagedPointersRemovalStep.cs:line 80
			//    at Telerik.JustDecompiler.Ast.BaseCodeVisitor.Visit(ICodeNode node) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Ast\BaseCodeVisitor.cs:line 351
			//    at Telerik.JustDecompiler.Steps.ManagedPointersRemovalStep.VisitExpressions() in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Steps\ManagedPointersRemovalStep.cs:line 41
			//    at Telerik.JustDecompiler.Steps.ManagedPointersRemovalStep.Process(DecompilationContext context, BlockStatement body) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Steps\ManagedPointersRemovalStep.cs:line 29
			//    at Telerik.JustDecompiler.Decompiler.DecompilationPipeline.RunInternal(MethodBody body, BlockStatement block, ILanguage language) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\DecompilationPipeline.cs:line 100
			//    at Telerik.JustDecompiler.Decompiler.DecompilationPipeline.Run(MethodBody body, ILanguage language) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\DecompilationPipeline.cs:line 72
			//    at Telerik.JustDecompiler.Decompiler.Extensions.RunPipeline(DecompilationPipeline pipeline, ILanguage language, MethodBody body, DecompilationContext& context) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\Extensions.cs:line 95
			//    at Telerik.JustDecompiler.Decompiler.Extensions.Decompile(MethodBody body, ILanguage language, DecompilationContext& context, TypeSpecificContext typeContext) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\Extensions.cs:line 61
			//    at Telerik.JustDecompiler.Decompiler.WriterContextServices.BaseWriterContextService.DecompileMethod(ILanguage language, MethodDefinition method, TypeSpecificContext typeContext) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\WriterContextServices\BaseWriterContextService.cs:line 118
			// 
			// mailto: JustDecompilePublicFeedback@telerik.com

		}

		public static IQueryable<TSource> WhereTrue<TSource>(this IQueryable<TSource> source, bool compareVaue, Expression<Func<TSource, bool>> predicateIf, Expression<Func<TSource, bool>> predicateElse = null)
		{
			if (compareVaue)
			{
				return source.Where<TSource>(predicateIf);
			}
			if (predicateElse == null)
			{
				return source;
			}
			return source.Where<TSource>(predicateElse);
		}
	}
}