コード例 #1
0
        public WfResult Run(CancellationToken token)
        {
            WfResult result = WfResult.Unknown;
            //_logger.Write(String.Format("SqlServer: {0} query: {1}", _attributes[CONNECTION_STRING], _attributes[QUERY_STRING]));

            int processId = Process.GetCurrentProcess().Id;

            _logger.Debug("Host process Id: {ProcessId}", processId);
            _logger.Debug("Running DeltaExtractor...");

            DERun runner = new DERun(_logger);

            return(runner.Start(_attributes, token));
        }
コード例 #2
0
        /// <summary>
        /// Entry point to Delta Extractor. Takes parameters defined by an XML string based
        /// on the parameters.XSD schema.
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        public static void Main(string[] args)
        {
            if (args.Length == 0 ||
                args.Contains(@"/help", StringComparer.InvariantCultureIgnoreCase))
            {
                help();
                Environment.Exit(0);
            }

            bool debug   = args.Contains(@"/D", StringComparer.InvariantCultureIgnoreCase);
            bool verbose = args.Contains(@"/V", StringComparer.InvariantCultureIgnoreCase);


            try
            {
                var     minLogLevel = (debug) ? LogEventLevel.Debug : LogEventLevel.Information;
                ILogger logger      = new LoggerConfiguration()
                                      .MinimumLevel.Is(minLogLevel)
                                      .WriteTo.Console()
                                      .CreateLogger();


                ;
                WorkflowAttributeCollection param = new WorkflowAttributeCollection();
                param.Add("XML", args[0]);

                using (CancellationTokenSource cts = new CancellationTokenSource())
                {
                    DERun    runner = new DERun(logger);
                    WfResult result = runner.Start(param, cts.Token);
                    if (result.StatusCode != WfStatus.Succeeded)
                    {
                        throw new Exception(String.Format("DE returned Status: {0}", result.StatusCode.ToString()));
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                Environment.Exit(1);
            }
            Environment.Exit(0);
        }