コード例 #1
0
ファイル: GetDatabase.cs プロジェクト: Yevrag35/SQL-SMO
 protected override void BeginProcessing()
 {
     base.BeginProcessing();
     if (_dynLib != null)
     {
         _dbs = new MgSmoCollection <Database>(base.RetrieveDatabases());
     }
 }
コード例 #2
0
 private void FilterByName(ref MgSmoCollection <View> views, WildcardPattern[] pats, Database db)
 {
     for (int i = 0; i < db.Views.Count; i++)
     {
         View v = db.Views[i];
         if (base.NameMatchesPatterns(v.Name, pats))
         {
             views.Add(v);
         }
     }
 }
コード例 #3
0
        protected private DynamicLibrary NewDynamicLibrary(MgSmoCollection <Database> dbCol)
        {
            var dl = new DynamicLibrary();
            var dp = new DynamicParameter <Database>(BaseDatabaseCmdlet.DBNAME, SmoContext.Databases, x => x.Name, "Name", true)
            {
                Mandatory = true
            };

            dl.Add(dp);
            return(dl);
        }
コード例 #4
0
ファイル: RemoveDatabase.cs プロジェクト: Yevrag35/SQL-SMO
        protected override void BeginProcessing()
        {
            if (this.SqlServer == null)
            {
                base.BeginProcessing();
                _server = SmoContext.Connection;
            }
            else
            {
                _server = this.SqlServer;
            }

            _dbs = new MgSmoCollection <Database>();
        }
コード例 #5
0
        //public object GetDynamicParameters()
        //{
        //    if (_dynLib == null)
        //        _dynLib = new DynamicLibrary();

        //    _dynLib.Clear();
        //    if (Database != null)
        //    {
        //        var dp = new DynamicParameter<Table>(TABNAME, Database.Tables.Cast<Table>(), x => x.Name, NAME, true)
        //        {
        //            Mandatory = false,
        //            ParameterSetName = "__AllParameterSets"
        //        };
        //        dp.Aliases.AddRange(Aliases);
        //        _dynLib.Add(dp);
        //    }
        //    else
        //    {
        //        _dynLib.Add(TABNAME, new RuntimeDefinedParameter(TABNAME, typeof(string[]), new Collection<Attribute>
        //                {
        //                    new AliasAttribute(Aliases),
        //                    new ParameterAttribute
        //                    {
        //                        Mandatory = false,
        //                        ParameterSetName = "__AllParameterSets"
        //                    }
        //                }));
        //    }
        //    return _dynLib;
        //}

        #endregion

        #region CMDLET PROCESSING
        protected override void BeginProcessing()
        {
            if (this.Database != null)
            {
                _server = this.Database.Parent;
            }

            else if (SmoContext.IsSet && SmoContext.IsConnected)
            {
                _server = SmoContext.Connection;
            }

            else
            {
                throw new SmoContextNotSetException();
            }

            _dbs = new MgSmoCollection <Database>();
        }
コード例 #6
0
        public static MgSmoCollection <T> WildcardMatch <T>(this MgSmoCollection <T> col, string propertyName, string propertyValue) where T : SqlSmoObject
        {
            var          wcp  = new WildcardPattern(propertyValue, WildcardOptions.IgnoreCase);
            var          list = new MgSmoCollection <T>(col.Count);
            PropertyInfo pi   = typeof(T).GetProperty(propertyName, PUB_INST);

            if (pi == null)
            {
                throw new ArgumentException("A property named " + propertyName + " could not be found.");
            }

            for (int i = 0; i < col.Count; i++)
            {
                T      item  = col[i];
                string piVal = pi.GetValue(item) as string;
                if (wcp.IsMatch(piVal))
                {
                    list.Add(item);
                }
            }
            return(list);
        }
コード例 #7
0
ファイル: GetDatabaseLog.cs プロジェクト: Yevrag35/SQL-SMO
 protected override void BeginProcessing()
 {
     base.BeginProcessing();
     _dbs = new MgSmoCollection <Database>();
 }
コード例 #8
0
 protected override void BeginProcessing()
 {
     base.BeginProcessing();
     _views = new MgSmoCollection <View>();
 }