Пример #1
0
        protected override CompilationResult Compile()
        {
            var script = this.Script.Trim();

            script = script.Contains(';') ? script : ("return " + script + ";");
            var entityTypeName = DynamicValidationEntity.GetMainType(this.GetParentEntity <DynamicValidationEntity>()).FullName;

            return(Compile(DynamicCode.GetCoreMetadataReferences()
                           .Concat(DynamicCode.GetMetadataReferences()), DynamicCode.GetUsingNamespaces() +
                           @"
namespace Signum.Entities.Dynamic
{
    class Evaluator : Signum.Entities.Dynamic.IDynamicValidationEvaluator
    {
        public string EvaluateUntyped(ModifiableEntity e, PropertyInfo pi)
        {
            return this.Evaluate((" + entityTypeName + @")e, pi);
        }

        string Evaluate(" + entityTypeName + @" e, PropertyInfo pi)
        {
            " + script + @"
        }
    }                   
}"));
        }
Пример #2
0
        protected override CompilationResult Compile()
        {
            var script = this.Script.Trim();

            script = script.Contains(';') ? script : ("return " + script + ";");
            var entityTypeName = ((DynamicTypeConditionEntity)this.GetParentEntity()).EntityType.ToType().FullName;

            return(Compile(DynamicCode.GetAssemblies(),
                           DynamicCode.GetUsingNamespaces() +
                           @"
namespace Signum.Entities.Dynamic
{
    class Evaluator : Signum.Entities.Dynamic.IDynamicTypeConditionEvaluator
    {
        public bool EvaluateUntyped(ModifiableEntity e)
        {
            return this.Evaluate((" + entityTypeName + @")e);
        }

        bool Evaluate(" + entityTypeName + @" e)
        {
            " + script + @"
        }
    }                   
}"));
        }
Пример #3
0
        protected override CompilationResult Compile()
        {
            var script = this.Script.Trim();

            return(Compile(DynamicCode.GetCoreMetadataReferences()
                           .Concat(DynamicCode.GetMetadataReferences()), DynamicCode.GetUsingNamespaces() +
                           @"
namespace Signum.Entities.Dynamic
{
    class Evaluator : ControllerBase, Signum.Entities.Dynamic.IDynamicApiEvaluator
    {
        " + script + @"

        public bool DummyEvaluate() => true;
    }
}"));
        }
Пример #4
0
 public static string GetUsingNamespaces()
 {
     return(DynamicCode.CreateUsings(GetNamespaces()));
 }