Exemplo n.º 1
0
        public static void Do()
        {
            var storageEngine = new SimpleFileStorageEngine("./persons.jsons", true);
            var os            = ObjectStore.New(storageEngine);

            var parent = new Person
            {
                Name = "Ole"
            };

            var child = new Person
            {
                Name   = "Peter",
                Parent = parent
            };

            os.Entangle(child);
            os.Persist();

            os = ObjectStore.Load(storageEngine);
            var p2 = os.Resolve <Person>();

            Console.WriteLine("Child: " + p2.Name);
            Console.WriteLine("Parent: " + p2.Parent.Name);
        }
Exemplo n.º 2
0
        public static void Do()
        {
            var @continue = File.Exists(@"./timer.txt");

            if (@continue)
            {
                Continue();
                return;
            }

            var storageEngine = new SimpleFileStorageEngine(@"./timer.txt", false);
            var scheduler     = new PoormansExecutionEngine();

            scheduler.Start(storageEngine, false);

            scheduler.Schedule(() => Console.WriteLine("Hello From Anonymous Function"));

            var cw = new ConsoleWriter("Hello From Console Writer");

            new PersistentTimer(
                DateTime.Now + TimeSpan.FromSeconds(10),
                cw.Do,
                false,
                scheduler
                );
        }
Exemplo n.º 3
0
        private static void Continue()
        {
            Console.WriteLine("CONTINUING!");

            var storageEngine = new SimpleFileStorageEngine($"./timer.txt", false);

            var scheduler = new PoormansExecutionEngine();

            scheduler.Start(storageEngine, true);
        }
Exemplo n.º 4
0
        public static void Continue()
        {
            var storage   = new SimpleFileStorageEngine(@"./TravelAgent.txt", false);
            var scheduler = ExecutionEngineFactory.Continue(storage);

            while (true)
            {
                Console.WriteLine("PRESS ENTER TO STOP PING PONG APP");
                Console.ReadLine();

                scheduler.Dispose();

                Console.WriteLine("PRESS ENTER TO START PING PONG APP");
                Console.ReadLine();

                scheduler = ExecutionEngineFactory.Continue(storage);
            }
        }
Exemplo n.º 5
0
        private static void Continue()
        {
            var storage = new SimpleFileStorageEngine("./ping_pong.txt", false);
            //var storage = new SqlServerStorageEngine("1", DatabaseHelper.ConnectionString("localhost", "ping_pong", "sa", "Pa55word"));

            var engine = ExecutionEngineFactory.Continue(storage);

            while (true)
            {
                Console.WriteLine("PRESS ENTER TO STOP PING PONG APP");
                Console.ReadLine();

                engine.Dispose();

                Console.WriteLine("PRESS ENTER TO START PING PONG APP");
                Console.ReadLine();

                engine = ExecutionEngineFactory.Continue(storage);
            }
        }
Exemplo n.º 6
0
        public static void StartNew()
        {
            var storage   = new SimpleFileStorageEngine(@"./TravelAgent.txt", true);
            var scheduler = ExecutionEngineFactory.StartNew(storage);

            scheduler.Schedule(() =>
            {
                var workflow = new Workflow();
                _            = workflow.Do();
            });

            Console.WriteLine("PRESS ENTER TO STOP PING PONG APP");
            Console.ReadLine();

            scheduler.Dispose();

            Console.WriteLine("PRESS ENTER TO START PING PONG APP");
            Console.ReadLine();

            Continue();
        }
Exemplo n.º 7
0
        public static void StartNew(StorageEngineImplementation storageEngine)
        {
            var storage = new SimpleFileStorageEngine("./ping_pong.txt", true);

            /*DatabaseHelper.CreateDatabaseIfNotExist("localhost", "ping_pong", "sa", "Pa55word");
             * var storage = new SqlServerStorageEngine("1", DatabaseHelper.ConnectionString("localhost", "ping_pong", "sa", "Pa55word"));
             *
             *  storage.Initialize();
             *  storage.Clear();*/
            var scheduler = ExecutionEngineFactory.StartNew(storage);

            scheduler.Schedule(() =>
            {
                var messages = new Source <string>();
                var pinger   = new Pinger {
                    Messages = messages
                };
                var ponger = new Ponger {
                    Messages = messages
                };

                _ = ponger.Start();
                _ = pinger.Start();
            });

            Console.WriteLine("PRESS ENTER TO STOP PING PONG APP");
            Console.ReadLine();

            scheduler.Dispose();
            storage.Dispose();

            Console.WriteLine("PRESS ENTER TO START PING PONG APP");
            Console.ReadLine();

            Continue();
        }