Esempio n. 1
0
        protected override void BeginProcessing()
        {
            base.BeginProcessing();


            if (this.MyInvocation.BoundParameters.ContainsKey(JOBNAME))
            {
                if (this.SqlServer == null && SmoContext.GetNullOrEmpty(SmoContext.Jobs))
                {
                    SmoContext.SetJobs(SmoContext.Connection.JobServer.Jobs);
                }

                else if (this.SqlServer != null)
                {
                    SmoContext.SetJobs(this.SqlServer.JobServer.Jobs);
                }

                _input = this.GetJobFromName(this.JobName);
            }


            else if (this.MyInvocation.BoundParameters.ContainsKey(JOBID))
            {
                _input = this.GetJobFromId(this.JobId, _server);
            }
        }
Esempio n. 2
0
        public object GetDynamicParameters()
        {
            if (SmoContext.IsSet && SmoContext.IsConnected && _dynLib == null)
            {
                if (SmoContext.GetNullOrEmpty(SmoContext.Jobs))
                {
                    SmoContext.SetJobs(SmoContext.Connection.JobServer.Jobs);
                }

                _dynLib = new DynamicLibrary();
                var dp = new DynamicParameter <Microsoft.SqlServer.Management.Smo.Agent.Job>("JobName", SmoContext.Jobs, x => x.Name, "Name", true)
                {
                    Position         = 0,
                    Mandatory        = false,
                    ParameterSetName = "ByJobName"
                };
                _dynLib.Add(dp);
            }
            else if (_dynLib == null)
            {
                _dynLib = new DynamicLibrary();
                _dynLib.Add("JobName", new RuntimeDefinedParameter("JobName", typeof(string[]), new Collection <Attribute>
                {
                    new ParameterAttribute
                    {
                        Mandatory        = false,
                        Position         = 0,
                        ParameterSetName = "ByJobName"
                    }
                }));
            }
            return(_dynLib);
        }
Esempio n. 3
0
        public virtual object GetDynamicParameters()
        {
            if (_dynLib == null && SmoContext.IsSet && SmoContext.IsConnected)
            {
                if (SmoContext.GetNullOrEmpty(SmoContext.Databases))
                {
                    SmoContext.SetDatabases(SmoContext.Connection.Databases);
                }

                _dynLib = this.NewDynamicLibrary(SmoContext.Databases);
            }
            else if (_dynLib == null)
            {
                _dynLib = this.NewDynamicLibrary();
            }


            return(_dynLib);
        }
Esempio n. 4
0
        public object GetDynamicParameters()
        {
            if (_dynLib == null && SmoContext.IsSet && SmoContext.IsConnected)
            {
                if (SmoContext.GetNullOrEmpty(SmoContext.Databases))
                {
                    SmoContext.SetDatabases(SmoContext.Connection.Databases);
                }

                _dynLib = new DynamicLibrary();
                IDynParam param = new DynamicParameter <Database>(DBNAME, SmoContext.Databases, x => x.Name, "Name", true)
                {
                    Mandatory = false,
                    Position  = 0,
                };
                param.Aliases.Add("n");
                _dynLib.Add(param);
            }
            else if (_dynLib == null)
            {
                _dynLib = new DynamicLibrary
                {
                    {
                        DBNAME,
                        new RuntimeDefinedParameter(DBNAME, typeof(string[]), new Collection <Attribute>
                        {
                            new ParameterAttribute
                            {
                                Mandatory = false,
                                Position  = 0
                            }
                        })
                    }
                };
            }
            return(_dynLib);
        }