Esempio n. 1
0
        public void RunDynamic()
        {
            var code         = @"
    using System;
namespace MyModel
{
    public class Xxx
    {
        public string Yyy { get; set; }
    }
}
";
            var assemblyName = "t_123_v_1.1";

            var wellKnownTypeContainer = new WellKnownTypeContainer();
            var typeContainer          = new TypeContainer(wellKnownTypeContainer);
            var assembly = DynamicModelLoader.Load(assemblyName, code);

            foreach (var type in assembly.GetTypes())
            {
                typeContainer.Add(type);
            }

            var customActivityParser = new CustomActivityParser(new WellKnownDescriptorContainer(), typeContainer);
            var definition           = LoadDefinition("dynamic");
            var activity             = customActivityParser.Parse(JsonSerializer.Deserialize <JsonElement>(definition));
            var compiler             = new ActivityCompiler(typeContainer);

            compiler.Compile("nnn", "mmmm", activity);
            var executor = new ActivityExecutor(null);

            executor.Run(activity);
        }
Esempio n. 2
0
        public void RunVariables()
        {
            var wellKnownTypeContainer = new WellKnownTypeContainer();
            var customActivityParser   =
                new CustomActivityParser(new WellKnownDescriptorContainer(), wellKnownTypeContainer);
            var definition = LoadDefinition("variables");
            var activity   = customActivityParser.Parse(JsonSerializer.Deserialize <JsonElement>(definition));
            var compiler   = new ActivityCompiler(wellKnownTypeContainer);

            compiler.Compile("nnn", "mmmm", activity);
            var executor = new ActivityExecutor(null);
            var appId    = executor.Run(activity);
        }
Esempio n. 3
0
        public void RunArguments()
        {
            var wellKnownTypeContainer = new WellKnownTypeContainer();
            var customActivityParser   =
                new CustomActivityParser(new WellKnownDescriptorContainer(), wellKnownTypeContainer);
            var definition = LoadDefinition("arguments");
            var activity   = customActivityParser.Parse(JsonSerializer.Deserialize <JsonElement>(definition));
            var compiler   = new ActivityCompiler(wellKnownTypeContainer);

            compiler.Compile("nnn", "mmmm", activity);
            var executor = new ActivityExecutor(null);
            var appId    = executor.Run(activity, new Dictionary <string, object> {
                { "a", "ggggg" }
            });
        }
Esempio n. 4
0
        public void RunCSharp()
        {
            var wellKnownTypeContainer = new WellKnownTypeContainer();
            var descriptorContainer    = new DescriptorContainer(new WellKnownDescriptorContainer());

            descriptorContainer.Add(new CSharpDescriptor());
            var customActivityParser = new CustomActivityParser(descriptorContainer, wellKnownTypeContainer);
            var definition           = LoadDefinition("csharp");
            var activity             = customActivityParser.Parse(JsonSerializer.Deserialize <JsonElement>(definition));
            var compiler             = new ActivityCompiler(wellKnownTypeContainer);

            compiler.Compile("nnn", "mmmm", activity);
            var executor = new ActivityExecutor(null);

            executor.Run(activity);
        }
Esempio n. 5
0
        public void RunTemp()
        {
            var wellKnownTypeContainer = new WellKnownTypeContainer();
            var customActivityParser   =
                new CustomActivityParser(new WellKnownDescriptorContainer(), wellKnownTypeContainer);
            var definition = LoadDefinition("temp");
            var activity   = customActivityParser.Parse(JsonSerializer.Deserialize <JsonElement>(definition));
            var compiler   = new ActivityCompiler(wellKnownTypeContainer);

            compiler.Compile("nnn", "mmmm", activity);
            var store    = new DefaultInstanceStore(new StrongTypeJsonFileRepository("e:\\workflow-instances"));
            var executor = new ActivityExecutor(null);
            var appId    = executor.Run(activity, new Dictionary <string, object> {
                { "v", "kknd" }
            });

            // var resumeSuccess = executor.Resume(activity, appId, "input", "aaaaa");
        }
Esempio n. 6
0
        public void RunMirrorUpdate()
        {
            var code         = @"
    using System;
namespace MyModels
{
    public class student
    {
        public string id {get;set;}
        public student_data data { get; set; }
    }

    public class student_data
    {
        public string name {get;set;}
        public int age {get;set;}
    }
}
";
            var assemblyName = "t_123_v_1.1";

            var wellKnownTypeContainer = new WellKnownTypeContainer();
            var typeContainer          = new TypeContainer(wellKnownTypeContainer);
            var assembly = DynamicModelLoader.Load(assemblyName, code);

            foreach (var type in assembly.GetTypes())
            {
                typeContainer.Add(type);
            }
            var descriptorContainer = new DescriptorContainer(new WellKnownDescriptorContainer());

            descriptorContainer.Add(new MirrorUpdateDescriptor());
            var customActivityParser = new CustomActivityParser(descriptorContainer, typeContainer);
            var definition           = LoadDefinition("mirrorUpdate");
            var activity             = customActivityParser.Parse(JsonSerializer.Deserialize <JsonElement>(definition));
            var compiler             = new ActivityCompiler(typeContainer);

            compiler.Compile("nnn", "mmmm", activity);
            var executor = new ActivityExecutor(null);

            executor.Run(activity);
        }