protected override void BeginProcessing() { base.BeginProcessing(); if (_dynLib != null) { _dbs = new MgSmoCollection <Database>(base.RetrieveDatabases()); } }
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); } } }
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); }
protected override void BeginProcessing() { if (this.SqlServer == null) { base.BeginProcessing(); _server = SmoContext.Connection; } else { _server = this.SqlServer; } _dbs = new MgSmoCollection <Database>(); }
//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>(); }
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); }
protected override void BeginProcessing() { base.BeginProcessing(); _dbs = new MgSmoCollection <Database>(); }
protected override void BeginProcessing() { base.BeginProcessing(); _views = new MgSmoCollection <View>(); }