protected override void BeginProcessing() { var expressions = Expression.Ast.FindAll(p => p.GetType().Name.Equals("BinaryExpressionAst"), true); if (expressions.Count() == 0) { throw new Exception("Error parsing expression - No binary expressions found!"); } _binaryExpressionAst = (BinaryExpressionAst)expressions.First(); var qu = ((IEnumerable)InputArray.BaseObject).AsQueryable(); var arguments = InputArray.BaseObject.GetType().GetTypeInfo().GenericTypeArguments; if (arguments.Count() == 0) { arguments = qu.GetType().GetTypeInfo().GenericTypeArguments; } if (arguments.Count() > 0) { var genericType = arguments[0]; var poshBinaryType = typeof(PoshBinaryConverter <>); var constructedPoshBinaryType = poshBinaryType.MakeGenericType(genericType); _binaryConverter = (IPoshBinaryConverter)Activator.CreateInstance(constructedPoshBinaryType, new object[] { qu, SessionState }); } else { throw new Exception("Error parsing InputArray - Must be a strongly typed collection like generic collections. See more here: https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic?view=dotnet-plat-ext-3.1"); } }
protected override void BeginProcessing() { var poshBinaryType = typeof(PoshBinaryConverter <>); var constructedPoshBinaryType = poshBinaryType.MakeGenericType(FuncType); _binaryConverter = (IPoshBinaryConverter)Activator.CreateInstance(constructedPoshBinaryType, new object[] { SessionState }); var expressions = Expression.Ast.FindAll(p => p.GetType().Name.Equals("BinaryExpressionAst"), true); if (expressions.Count() == 0) { throw new Exception("Error parsing expression - No binary expressions found!"); } _binaryExpressionAst = (BinaryExpressionAst)expressions.First(); }