static void Main(string[] args) { var console = new ClientConsole(); //Note: Using the singleton version //var configuration = Singleton.Configuration.Instance; //var client = Singleton.Quilt4NetClient.Instance; //var sessionHandler = Singleton.Session.Instance; //var issueHandler = Singleton.Issue.Instance; //Note: Using the created instance version var configuration = new Configuration(); var client = new Quilt4NetClient(configuration); var sessionHandler = new SessionHandler(client); var issueHandler = new IssueHandler(sessionHandler); //Note: Config in code //configuration.Enabled = true; //Turn the entire quilt4Net feature on or off. //configuration.ProjectApiKey = "9XG02ZE0BR1OI75IVX446B59M13RKBR_"; //TODO: Replace with your own ProjectApiKey. //configuration.ApplicationName = "MyOverrideApplication"; //Overrides the name of the assembly //configuration.ApplicationVersion = "MyOverrideVersion"; //Overrides the version of the assembly //configuration.UseBuildTime = false; //If true, separate 'versions' for each build of the assembly will be logged, even though the version number have not changed. //configuration.Session.Environment = "Test"; //Use dev, test, production or any other verb you like to filter on. //configuration.Target.Location = "http://localhost:29660"; //Address to the target service. //configuration.Target.Timeout = new TimeSpan(0, 0, 60); console.WriteLine("Connecting to quilt4 server " + configuration.Target.Location, OutputLevel.Information); sessionHandler.SessionRegistrationStartedEvent += Session_SessionRegistrationStartedEvent; sessionHandler.SessionRegistrationCompletedEvent += SessionSessionRegistrationCompletedEvent; sessionHandler.SessionEndStartedEvent += Session_SessionEndStartedEvent; sessionHandler.SessionEndCompletedEvent += Session_SessionEndCompletedEvent; issueHandler.IssueRegistrationStartedEvent += Issue_IssueRegistrationStartedEvent; issueHandler.IssueRegistrationCompletedEvent += Issue_IssueRegistrationCompletedEvent; client.WebApiClient.AuthorizationChangedEvent += WebApiClient_AuthorizationChangedEvent; client.WebApiClient.WebApiRequestEvent += WebApiClientWebApiRequestEvent; client.WebApiClient.WebApiResponseEvent += WebApiClient_WebApiResponseEvent; _rootCommand = new RootCommand(console); _rootCommand.RegisterCommand(new UserCommands(client)); _rootCommand.RegisterCommand(new ProjectCommands(client)); _rootCommand.RegisterCommand(new InvitationCommands(client)); _rootCommand.RegisterCommand(new SessionCommands(sessionHandler)); _rootCommand.RegisterCommand(new IssueCommands(issueHandler)); _rootCommand.RegisterCommand(new SettingCommands(client)); _rootCommand.RegisterCommand(new ServiceCommands(client)); _rootCommand.RegisterCommand(new WebCommands(issueHandler, client.WebApiClient)); new CommandEngine(_rootCommand).Run(args); sessionHandler.Dispose(); }
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); } }