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); } }
public ToggleController(SampleDb context) : base("toggle", "Toggle test controller") { _context = context; if (controller == null) controller = new TestController(_context); }
public JobController(SampleDb context) : base("job", "Check Job") { _context = context; }
public FillOrderCommand(SampleDb context) : base("fillorder", "Add some orders to database") { _context = context; }
public EditOrder(SampleDb context) : base("edit", "Edit last Order entry") { _context = context; }
public QueryAuditTrail(SampleDb context) : base("audit", "Check last AuditTrail entry") { _context = context; }
public QueryOrder(SampleDb context) : base("order", "Check last Order") { _context = context; }