<commit_before>using Signum.Engine;
using Signum.Engine.Basics;
using Signum.Engine.Dynamic;
using Signum.Engine.DynamicQuery;
using Signum.Engine.Maps;
using Signum.Entities;
using Signum.Entities.Basics;
using Signum.Entities.Dynamic;
using Signum.Utilities;
using System;
using System.Globalization;
using Microsoft.AspNetCore.Mvc;
using Signum.React.Filters;
using System.ComponentModel.DataAnnotations;

namespace Signum.React.Dynamic
{
    [ValidateModelFilter]
    public class DynamicExpressionController : ControllerBase
    {
        [HttpPost("api/dynamic/expression/test")]
        public DynamicExpressionTestResponse Test([Required, FromBody]DynamicExpressionTestRequest request)
        {
            IDynamicExpressionEvaluator evaluator;
            var de = request.dynamicExpression;
            try
            {
                var code = $@"
{DynamicCode.GetUsingNamespaces()}

namespace Signum.Entities.Dynamic
{{
    public class ExprEvaluator : Signum.Entities.Dynamic.IDynamicExpressionEvaluator
    {{
        static Expression<Func<{de.FromType}, {de.ReturnType}>> {de.Name}Expression =
            e => {de.Body};
        //[ExpressionField]
        public static {de.ReturnType} {de.Name}({de.FromType} e)
        {{
            return {de.Name}Expression.Compile().Invoke(e);
        }}
<commit_msg>add missing using<commit_after>using Signum.Engine;
using Signum.Engine.Basics;
using Signum.Engine.Dynamic;
using Signum.Engine.DynamicQuery;
using Signum.Engine.Maps;
using Signum.Entities;
using Signum.Entities.Basics;
using Signum.Entities.Dynamic;
using Signum.Utilities;
using System;
using System.Globalization;
using Microsoft.AspNetCore.Mvc;
using Signum.React.Filters;
using System.ComponentModel.DataAnnotations;
using System.Linq;

namespace Signum.React.Dynamic
{
    [ValidateModelFilter]
    public class DynamicExpressionController : ControllerBase
    {
        [HttpPost("api/dynamic/expression/test")]
        public DynamicExpressionTestResponse Test([Required, FromBody]DynamicExpressionTestRequest request)
        {
            IDynamicExpressionEvaluator evaluator;
            var de = request.dynamicExpression;
            try
            {
                var code = $@"
{DynamicCode.GetUsingNamespaces()}

namespace Signum.Entities.Dynamic
{{
    public class ExprEvaluator : Signum.Entities.Dynamic.IDynamicExpressionEvaluator
    {{
        static Expression<Func<{de.FromType}, {de.ReturnType}>> {de.Name}Expression =
            e => {de.Body};
        //[ExpressionField]
        public static {de.ReturnType} {de.Name}({de.FromType} e)
        {{
            return {de.Name}Expression.Compile().Invoke(e);
        }}

{'fraction_non_alphanumeric': 0.1013790532985464, 'fraction_numerical': 0.0, 'mean_word_length': 3.357142857142857, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4228986', 'n_tokens_mistral': 743, 'n_tokens_neox': 761, 'n_words': 144}