Пример #1
0
        /// <summary>
        /// Generates the steps required to ensure the instance.
        /// </summary>
        /// <param name="arguments"></param>
        /// <param name="relativeRoot"></param>
        /// <returns></returns>
        internal IEnumerable <SqlDeploymentAction> Compile(IDictionary <string, string> arguments, string relativeRoot)
        {
            if (relativeRoot is null)
            {
                throw new ArgumentNullException(nameof(relativeRoot));
            }

            var context = new SqlDeploymentCompileContext(arguments, Name.Expand <string>(arguments), relativeRoot);

            if (Install != null)
            {
                foreach (var s in Install.Compile(context))
                {
                    yield return(s);
                }
            }

            if (Configuration != null)
            {
                foreach (var s in Configuration.Compile(context))
                {
                    yield return(s);
                }
            }

            foreach (var i in LinkedServers)
            {
                foreach (var s in i.Compile(context))
                {
                    yield return(s);
                }
            }

            if (Distributor != null)
            {
                foreach (var s in Distributor.Compile(context))
                {
                    yield return(s);
                }
            }

            if (Publisher != null)
            {
                foreach (var s in Publisher.Compile(context))
                {
                    yield return(s);
                }
            }

            foreach (var i in Databases)
            {
                foreach (var s in i.Compile(context))
                {
                    yield return(s);
                }
            }
        }