public static string GetSnippetFilterExpression(RowPermissionsSingleFunctionRuleInfo info, bool allowNotDeny)
        {
            return(string.Format(
                       @"{{
				Func<Common.ExecutionContext, Expression<Func<Common.Queryable.{0}_{1}, bool>>> getRuleFilter =
                    {2};
				Expression<Func<Common.Queryable.{0}_{1}, bool>> ruleFilter = getRuleFilter.Invoke(executionContext);
				filterExpression.{3}(ruleFilter);
			}}
            ",
                       info.RowPermissionsFilters.DataStructure.Module.Name,
                       info.RowPermissionsFilters.DataStructure.Name,
                       info.FilterExpressionFunction,
                       allowNotDeny ? "Include" : "Exclude"));
        }
        public static string CreateRuleExpressionMethod(ICodeBuilder codeBuilder, RowPermissionsSingleFunctionRuleInfo info)
        {
            var target        = info.RowPermissionsFilters.DataStructure;
            var queryableType = $"Common.Queryable.{target.Module.Name}_{target.Name}";

            string methodName           = $"GetRowPermissionsRule_{info.Name}";
            var    methodParameters     = new[] { "Common.ExecutionContext" };
            string additionalParameters = $",\r\n            // Additional parameters for backward compatibility, should be removed in future releases:"
                                          + $"\r\n            IQueryable<{queryableType}> items, Common.DomRepository repository";
            // TODO: Remove additionalParameters in next major release. The lambda expression (code snippet) in row permission concepts has only parameter "context",
            // but developers sometimes used 'repository' variable from the parent method that was accidentally available in the code snippet.
            // The additionalParameters will provide all previously available variables to avoid breaking changes in minor release.

            var    parsedExpression = new ParsedExpression(info.FilterExpressionFunction, methodParameters, info, additionalParameters: additionalParameters);
            string filterMethod     =
                $@"private Expression<Func<{queryableType}, bool>> {methodName}{parsedExpression.MethodParametersAndBody}

        ";

            codeBuilder.InsertCode(filterMethod, RepositoryHelper.RepositoryMembers, target);
            return(methodName);
        }