Exemplo n.º 1
0
        /* ****************************************************************************************************** *
        * ---------------------------                HELPING METHODS              ------------------------------ *
        * ****************************************************************************************************** */

        private FunctionInformation BasicAggregateImplementation(MethodCallExpression methodExpression, string functionName, FunctionInformation.FunctionType functionType)
        {
            int argumentCount = methodExpression.Arguments.Count;

            FunctionInformation information = new FunctionInformation()
            {
                Name = functionName,
                Type = functionType,
                MeaningfulArguments = new object[1]
            };

            System.Type argumentType = methodExpression.Arguments[0].Type.GenericTypeArguments[0];

            string entityFullName = argumentType.IsInterface ? default(string) : argumentType.FullName;

            string fqn = new FullyQualifiedNameVisitor().BringFQN(methodExpression);

            fqn = fqn ?? entityFullName + (argumentCount > 1 ? GetSelectorBody(methodExpression.Arguments[1]) : "");

            information.MeaningfulArguments[0] = fqn;
            information.WhereContribution      = argumentCount > 1 ? OQLBuilder.BuildWhereClause(currentContext, methodExpression.Arguments[1], out OQLBuilder oqlBuilder).Trim() : default(string);

            Logger.Log(
                "Function Information: " + information.ToLog(),
                Microsoft.Extensions.Logging.LogLevel.Debug
                );

            return(information);
        }