Inheritance: BusinessDbContext
Exemplo n.º 1
0
        private static void Main(string[] args)
        {
            var console = new ClientConsole();
            Effort.Provider.EffortProviderConfiguration.RegisterProvider();
            var connection = DbConnectionFactory.CreateTransient();

            using (var context = new SampleDb(connection, "geo"))
            {
                console.WriteLine("Welcome to EF Test Console, type help to check available commands",
                    OutputLevel.Information, null);

                context.Products.AddRange(new[]
                {
                    new Product {Name = "CocaCola"},
                    new Product {Name = "Pepsi"},
                    new Product {Name = "Starbucks"},
                    new Product {Name = "Donut"}
                });

                context.SaveChanges();

                var ct = new System.Threading.CancellationToken();
                Task.Run(() => { SingletonSampleJob.Instance.RunBackgroundWork(ct); }, ct);

                var command = new RootCommand(console);

                command.RegisterCommand(new FillOrderCommand(context));
                command.RegisterCommand(new EditOrder(context));
                command.RegisterCommand(new QueryAuditTrail(context));
                command.RegisterCommand(new QueryOrder(context));
                command.RegisterCommand(new ToggleController(context));
                command.RegisterCommand(new JobController(context));

                var commandEngine = new CommandEngine(command);

                commandEngine.Run(args);
            }
        }
Exemplo n.º 2
0
            public ToggleController(SampleDb context)
                : base("toggle", "Toggle test controller")
            {
                _context = context;

                if (controller == null)
                    controller = new TestController(_context);
            }
Exemplo n.º 3
0
 public JobController(SampleDb context)
     : base("job", "Check Job")
 {
     _context = context;
 }
Exemplo n.º 4
0
 public FillOrderCommand(SampleDb context)
     : base("fillorder", "Add some orders to database")
 {
     _context = context;
 }
Exemplo n.º 5
0
 public EditOrder(SampleDb context)
     : base("edit", "Edit last Order entry")
 {
     _context = context;
 }
Exemplo n.º 6
0
 public QueryAuditTrail(SampleDb context)
     : base("audit", "Check last AuditTrail entry")
 {
     _context = context;
 }
Exemplo n.º 7
0
 public QueryOrder(SampleDb context)
     : base("order", "Check last Order")
 {
     _context = context;
 }