コード例 #1
0
        public void InitForQuery(Document queryDoc)
        {
            tiny          = TinyIoCContainer.Current;
            queryHasRun   = false;
            this.queryDoc = queryDoc;
            dte           = queryDoc.DTE;
            query         = new Query(this);
            _config       = _configResolver.GetConfig(queryDoc.FullName, query.Text);
            if (string.IsNullOrEmpty(Config.DefaultConnection))
            {
                return; // absence will be picked up in conductor. Not fabulous.
            }
            provider = tiny.Resolve <IProvider>(Config.Provider);
            // resolving the target project item for code generation. We know the file name, we loop through child items of the query til we find it.
            var target = Conductor.GetItemByFilename(queryDoc.ProjectItem.ProjectItems, GeneratedClassFullFilename);

            if (target == null)
            {
                // .net core has a little problem with nested items.
                target = Conductor.GetItemByFilename(queryDoc.ProjectItem.ContainingProject.ProjectItems, GeneratedClassFullFilename);
            }
            _putCodeHere = new PutCodeHere(target);

            string currDir = Path.GetDirectoryName(queryDoc.FullName);
        }
コード例 #2
0
        public void Run()
        {
            try
            {
                if (!ExeUtils.IsSingleInstance())
                {
                    throw new UserException(string.Format("Only one instance of {0} is allowed!", ExeUtils.GetAssemblyTitle()));
                }

                var config = _configResolver.GetConfig();
                _replicationWorker.Run(config);
            }
            catch (RouteNotSpecifiedException e)
            {
                OutputHelp(e.Message);
            }
            catch (AggregateException e)
            {
                if (e.Flatten().InnerExceptions.Where(x => x is RouteNotSpecifiedException).Any())
                {
                    OutputHelp(e.Flatten().InnerExceptions.Where(x => x is RouteNotSpecifiedException).First().Message);
                }
                else
                {
                    throw;
                }
            }
        }
コード例 #3
0
        public string GetLogFileName()
        {
            var config = _configResolver.GetConfig();

            if ((config.RouteConfigs != null) && (config.RouteConfigs.Where(x => !x.HashCheckMoment.HasValue).Any()))
            {
                return(config.LogFileName);
            }

            var extension      = System.IO.Path.GetExtension(config.LogFileName);
            var checkExtension = ".check" + extension;

            return(System.IO.Path.ChangeExtension(config.LogFileName, checkExtension));
        }