mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-15 09:35:37 -05:00
2205 lines
85 KiB
C#
2205 lines
85 KiB
C#
// This file was generated by a T4 Template. Do not modify directly, instead update the SmoQueryModelDefinition.xml file
|
|
// and re-run the T4 template. This can be done in Visual Studio by right-click in and choosing "Run Custom Tool",
|
|
// or from the command-line on any platform by running "build.cmd -Target=CodeGen" or "build.sh -Target=CodeGen".
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Composition;
|
|
using System.Linq;
|
|
using Microsoft.SqlServer.Management.Smo;
|
|
using Microsoft.SqlServer.Management.Smo.Broker;
|
|
|
|
namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
|
|
{
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlDatabaseQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(Database) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
Server parentServer = context.Parent as Server;
|
|
if (parentServer != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentServer.Databases.Refresh(true);
|
|
}
|
|
var retValue = parentServer.Databases;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentServer, filter, "Database");
|
|
}
|
|
return GetSmoCollectionResult<Database>(urns, retValue, parentServer);
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlLinkedServerLoginQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(LinkedServer) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
Server parentServer = context.Parent as Server;
|
|
if (parentServer != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentServer.LinkedServers.Refresh(true);
|
|
}
|
|
var retValue = parentServer.LinkedServers;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentServer, filter, "LinkedServer");
|
|
}
|
|
return GetSmoCollectionResult<LinkedServer>(urns, retValue, parentServer);
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlLoginQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(Login) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
Server parentServer = context.Parent as Server;
|
|
if (parentServer != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentServer.Logins.Refresh(true);
|
|
}
|
|
var retValue = parentServer.Logins;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentServer, filter, "Login");
|
|
}
|
|
return GetSmoCollectionResult<Login>(urns, retValue, parentServer);
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlServerRoleQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(ServerRole) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
Server parentServer = context.Parent as Server;
|
|
if (parentServer != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentServer.Roles.Refresh(true);
|
|
}
|
|
var retValue = parentServer.Roles;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentServer, filter, "ServerRole");
|
|
}
|
|
return GetSmoCollectionResult<ServerRole>(urns, retValue, parentServer);
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlCredentialQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(Credential) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
Server parentServer = context.Parent as Server;
|
|
if (parentServer != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentServer.Credentials.Refresh(true);
|
|
}
|
|
var retValue = parentServer.Credentials;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentServer, filter, "Credential");
|
|
}
|
|
return GetSmoCollectionResult<Credential>(urns, retValue, parentServer);
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlCryptographicProviderQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(CryptographicProvider) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
Server parentServer = context.Parent as Server;
|
|
if (parentServer != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentServer.CryptographicProviders.Refresh(true);
|
|
}
|
|
var retValue = parentServer.CryptographicProviders;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentServer, filter, "CryptographicProvider");
|
|
}
|
|
return GetSmoCollectionResult<CryptographicProvider>(urns, retValue, parentServer);
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlServerAuditQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(Audit) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
Server parentServer = context.Parent as Server;
|
|
if (parentServer != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentServer.Audits.Refresh(true);
|
|
}
|
|
var retValue = parentServer.Audits;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentServer, filter, "Audit");
|
|
}
|
|
return GetSmoCollectionResult<Audit>(urns, retValue, parentServer);
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlServerAuditSpecificationQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(ServerAuditSpecification) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
Server parentServer = context.Parent as Server;
|
|
if (parentServer != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentServer.ServerAuditSpecifications.Refresh(true);
|
|
}
|
|
var retValue = parentServer.ServerAuditSpecifications;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentServer, filter, "ServerAuditSpecification");
|
|
}
|
|
return GetSmoCollectionResult<ServerAuditSpecification>(urns, retValue, parentServer);
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlEndpointQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(Endpoint) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
Server parentServer = context.Parent as Server;
|
|
if (parentServer != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentServer.Endpoints.Refresh(true);
|
|
}
|
|
var retValue = parentServer.Endpoints;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentServer, filter, "Endpoint");
|
|
}
|
|
return GetSmoCollectionResult<Endpoint>(urns, retValue, parentServer);
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlLinkedServerQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(LinkedServer) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
Server parentServer = context.Parent as Server;
|
|
if (parentServer != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentServer.LinkedServers.Refresh(true);
|
|
}
|
|
var retValue = parentServer.LinkedServers;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentServer, filter, "LinkedServer");
|
|
}
|
|
return GetSmoCollectionResult<LinkedServer>(urns, retValue, parentServer);
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlServerDdlTriggerQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(ServerDdlTrigger) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
Server parentServer = context.Parent as Server;
|
|
if (parentServer != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentServer.Triggers.Refresh(true);
|
|
}
|
|
var retValue = parentServer.Triggers;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentServer, filter, "ServerDdlTrigger");
|
|
}
|
|
return GetSmoCollectionResult<ServerDdlTrigger>(urns, retValue, parentServer);
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlErrorMessageQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(UserDefinedMessage) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
Server parentServer = context.Parent as Server;
|
|
if (parentServer != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentServer.UserDefinedMessages.Refresh(true);
|
|
}
|
|
var retValue = parentServer.UserDefinedMessages;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentServer, filter, "UserDefinedMessage");
|
|
}
|
|
return GetSmoCollectionResult<UserDefinedMessage>(urns, retValue, parentServer);
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlTableQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(Table) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
Database parentDatabase = context.Parent as Database;
|
|
if (parentDatabase != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentDatabase.Tables.Refresh(true);
|
|
}
|
|
var retValue = parentDatabase.Tables;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentDatabase, filter, "Table");
|
|
}
|
|
return GetSmoCollectionResult<Table>(urns, retValue, parentDatabase);
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlHistoryTableQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(Table) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
Table parentTable = context.Parent as Table;
|
|
if (parentTable != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentTable.Parent.Tables.Refresh(true);
|
|
}
|
|
var retValue = parentTable.Parent.Tables;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentTable.Parent, filter, "Table");
|
|
}
|
|
return GetSmoCollectionResult<Table>(urns, retValue, parentTable);
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlViewQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(View) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
Database parentDatabase = context.Parent as Database;
|
|
if (parentDatabase != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentDatabase.Views.Refresh(true);
|
|
}
|
|
var retValue = parentDatabase.Views;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentDatabase, filter, "View");
|
|
}
|
|
return GetSmoCollectionResult<View>(urns, retValue, parentDatabase);
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlSynonymQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(Synonym) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
Database parentDatabase = context.Parent as Database;
|
|
if (parentDatabase != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentDatabase.Synonyms.Refresh(true);
|
|
}
|
|
var retValue = parentDatabase.Synonyms;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentDatabase, filter, "Synonym");
|
|
}
|
|
return GetSmoCollectionResult<Synonym>(urns, retValue, parentDatabase);
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlColumnQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(Column) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
TableViewTableTypeBase parentTableViewTableTypeBase = context.Parent as TableViewTableTypeBase;
|
|
if (parentTableViewTableTypeBase != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentTableViewTableTypeBase.Columns.Refresh(true);
|
|
}
|
|
var retValue = parentTableViewTableTypeBase.Columns;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentTableViewTableTypeBase, filter, "Column");
|
|
}
|
|
return GetSmoCollectionResult<Column>(urns, retValue, parentTableViewTableTypeBase);
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlIndexQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(Index) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
TableViewTableTypeBase parentTableViewTableTypeBase = context.Parent as TableViewTableTypeBase;
|
|
if (parentTableViewTableTypeBase != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentTableViewTableTypeBase.Indexes.Refresh(true);
|
|
}
|
|
var retValue = parentTableViewTableTypeBase.Indexes;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentTableViewTableTypeBase, filter, "Index");
|
|
}
|
|
return GetSmoCollectionResult<Index>(urns, retValue, parentTableViewTableTypeBase);
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlCheckQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(Check) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
Table parentTable = context.Parent as Table;
|
|
if (parentTable != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentTable.Checks.Refresh(true);
|
|
}
|
|
var retValue = parentTable.Checks;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentTable, filter, "Check");
|
|
}
|
|
return GetSmoCollectionResult<Check>(urns, retValue, parentTable);
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlForeignKeyConstraintQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(ForeignKey) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
Table parentTable = context.Parent as Table;
|
|
if (parentTable != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentTable.ForeignKeys.Refresh(true);
|
|
}
|
|
var retValue = parentTable.ForeignKeys;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentTable, filter, "ForeignKey");
|
|
}
|
|
return GetSmoCollectionResult<ForeignKey>(urns, retValue, parentTable);
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlDefaultConstraintQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(DefaultConstraint) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
Column parentColumn = context.Parent as Column;
|
|
if (parentColumn != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentColumn.DefaultConstraint.Refresh();
|
|
}
|
|
var retValue = parentColumn.DefaultConstraint;
|
|
if (retValue != null)
|
|
{
|
|
return new SqlSmoObject[] { retValue };
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlDmlTriggerQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(Trigger) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
Table parentTable = context.Parent as Table;
|
|
if (parentTable != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentTable.Triggers.Refresh(true);
|
|
}
|
|
var retValue = parentTable.Triggers;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentTable, filter, "Trigger");
|
|
}
|
|
return GetSmoCollectionResult<Trigger>(urns, retValue, parentTable);
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlFullTextIndexQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(FullTextIndex) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
Table parentTable = context.Parent as Table;
|
|
if (parentTable != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentTable.FullTextIndex.Refresh();
|
|
}
|
|
var retValue = parentTable.FullTextIndex;
|
|
if (retValue != null)
|
|
{
|
|
return new SqlSmoObject[] { retValue };
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlStatisticQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(Statistic) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
TableViewBase parentTableViewBase = context.Parent as TableViewBase;
|
|
if (parentTableViewBase != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentTableViewBase.Statistics.Refresh(true);
|
|
}
|
|
var retValue = parentTableViewBase.Statistics;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentTableViewBase, filter, "Statistic");
|
|
}
|
|
return GetSmoCollectionResult<Statistic>(urns, retValue, parentTableViewBase);
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlDatabaseDdlTriggerQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(DatabaseDdlTrigger) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
Database parentDatabase = context.Parent as Database;
|
|
if (parentDatabase != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentDatabase.Triggers.Refresh(true);
|
|
}
|
|
var retValue = parentDatabase.Triggers;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentDatabase, filter, "DatabaseDdlTrigger");
|
|
}
|
|
return GetSmoCollectionResult<DatabaseDdlTrigger>(urns, retValue, parentDatabase);
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlAssemblyQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(SqlAssembly) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
Database parentDatabase = context.Parent as Database;
|
|
if (parentDatabase != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentDatabase.Assemblies.Refresh(true);
|
|
}
|
|
var retValue = parentDatabase.Assemblies;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentDatabase, filter, "SqlAssembly");
|
|
}
|
|
return GetSmoCollectionResult<SqlAssembly>(urns, retValue, parentDatabase);
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlSequenceQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(Sequence) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
Database parentDatabase = context.Parent as Database;
|
|
if (parentDatabase != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentDatabase.Sequences.Refresh(true);
|
|
}
|
|
var retValue = parentDatabase.Sequences;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentDatabase, filter, "Sequence");
|
|
}
|
|
return GetSmoCollectionResult<Sequence>(urns, retValue, parentDatabase);
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlUserDefinedDataTypeQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(UserDefinedDataType) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
Database parentDatabase = context.Parent as Database;
|
|
if (parentDatabase != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentDatabase.UserDefinedDataTypes.Refresh(true);
|
|
}
|
|
var retValue = parentDatabase.UserDefinedDataTypes;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentDatabase, filter, "UserDefinedDataType");
|
|
}
|
|
return GetSmoCollectionResult<UserDefinedDataType>(urns, retValue, parentDatabase);
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlUserDefinedTableTypeQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(UserDefinedTableType) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
Database parentDatabase = context.Parent as Database;
|
|
if (parentDatabase != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentDatabase.UserDefinedTableTypes.Refresh(true);
|
|
}
|
|
var retValue = parentDatabase.UserDefinedTableTypes;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentDatabase, filter, "UserDefinedTableType");
|
|
}
|
|
return GetSmoCollectionResult<UserDefinedTableType>(urns, retValue, parentDatabase);
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlXmlSchemaCollectionQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(XmlSchemaCollection) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
Database parentDatabase = context.Parent as Database;
|
|
if (parentDatabase != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentDatabase.XmlSchemaCollections.Refresh(true);
|
|
}
|
|
var retValue = parentDatabase.XmlSchemaCollections;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentDatabase, filter, "XmlSchemaCollection");
|
|
}
|
|
return GetSmoCollectionResult<XmlSchemaCollection>(urns, retValue, parentDatabase);
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlUserDefinedTypeQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(UserDefinedType) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
Database parentDatabase = context.Parent as Database;
|
|
if (parentDatabase != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentDatabase.UserDefinedTypes.Refresh(true);
|
|
}
|
|
var retValue = parentDatabase.UserDefinedTypes;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentDatabase, filter, "UserDefinedType");
|
|
}
|
|
return GetSmoCollectionResult<UserDefinedType>(urns, retValue, parentDatabase);
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlUserDefinedFunctionQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(UserDefinedFunction) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
Database parentDatabase = context.Parent as Database;
|
|
if (parentDatabase != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentDatabase.UserDefinedFunctions.Refresh(true);
|
|
}
|
|
var retValue = parentDatabase.UserDefinedFunctions;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentDatabase, filter, "UserDefinedFunction");
|
|
}
|
|
return GetSmoCollectionResult<UserDefinedFunction>(urns, retValue, parentDatabase);
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlUserDefinedAggregateQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(UserDefinedAggregate) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
Database parentDatabase = context.Parent as Database;
|
|
if (parentDatabase != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentDatabase.UserDefinedAggregates.Refresh(true);
|
|
}
|
|
var retValue = parentDatabase.UserDefinedAggregates;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentDatabase, filter, "UserDefinedAggregate");
|
|
}
|
|
return GetSmoCollectionResult<UserDefinedAggregate>(urns, retValue, parentDatabase);
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlFileGroupQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(FileGroup) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
Database parentDatabase = context.Parent as Database;
|
|
if (parentDatabase != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentDatabase.FileGroups.Refresh(true);
|
|
}
|
|
var retValue = parentDatabase.FileGroups;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentDatabase, filter, "FileGroup");
|
|
}
|
|
return GetSmoCollectionResult<FileGroup>(urns, retValue, parentDatabase);
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlFileQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(DataFile) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
FileGroup parentFileGroup = context.Parent as FileGroup;
|
|
if (parentFileGroup != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentFileGroup.Files.Refresh(true);
|
|
}
|
|
var retValue = parentFileGroup.Files;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentFileGroup, filter, "DataFile");
|
|
}
|
|
return GetSmoCollectionResult<DataFile>(urns, retValue, parentFileGroup);
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlFullTextCatalogQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(FullTextCatalog) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
Database parentDatabase = context.Parent as Database;
|
|
if (parentDatabase != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentDatabase.FullTextCatalogs.Refresh(true);
|
|
}
|
|
var retValue = parentDatabase.FullTextCatalogs;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentDatabase, filter, "FullTextCatalog");
|
|
}
|
|
return GetSmoCollectionResult<FullTextCatalog>(urns, retValue, parentDatabase);
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlFullTextStopListQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(FullTextStopList) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
Database parentDatabase = context.Parent as Database;
|
|
if (parentDatabase != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentDatabase.FullTextStopLists.Refresh(true);
|
|
}
|
|
var retValue = parentDatabase.FullTextStopLists;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentDatabase, filter, "FullTextStopList");
|
|
}
|
|
return GetSmoCollectionResult<FullTextStopList>(urns, retValue, parentDatabase);
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlPartitionFunctionQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(PartitionFunction) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
Database parentDatabase = context.Parent as Database;
|
|
if (parentDatabase != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentDatabase.PartitionFunctions.Refresh(true);
|
|
}
|
|
var retValue = parentDatabase.PartitionFunctions;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentDatabase, filter, "PartitionFunction");
|
|
}
|
|
return GetSmoCollectionResult<PartitionFunction>(urns, retValue, parentDatabase);
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlPartitionSchemeQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(PartitionScheme) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
Database parentDatabase = context.Parent as Database;
|
|
if (parentDatabase != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentDatabase.PartitionSchemes.Refresh(true);
|
|
}
|
|
var retValue = parentDatabase.PartitionSchemes;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentDatabase, filter, "PartitionScheme");
|
|
}
|
|
return GetSmoCollectionResult<PartitionScheme>(urns, retValue, parentDatabase);
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlSearchPropertyListQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(SearchPropertyList) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
Database parentDatabase = context.Parent as Database;
|
|
if (parentDatabase != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentDatabase.SearchPropertyLists.Refresh(true);
|
|
}
|
|
var retValue = parentDatabase.SearchPropertyLists;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentDatabase, filter, "SearchPropertyList");
|
|
}
|
|
return GetSmoCollectionResult<SearchPropertyList>(urns, retValue, parentDatabase);
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlUserQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(User) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
Database parentDatabase = context.Parent as Database;
|
|
if (parentDatabase != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentDatabase.Users.Refresh(true);
|
|
}
|
|
var retValue = parentDatabase.Users;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentDatabase, filter, "User");
|
|
}
|
|
return GetSmoCollectionResult<User>(urns, retValue, parentDatabase);
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlSchemaQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(Schema) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
Database parentDatabase = context.Parent as Database;
|
|
if (parentDatabase != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentDatabase.Schemas.Refresh(true);
|
|
}
|
|
var retValue = parentDatabase.Schemas;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentDatabase, filter, "Schema");
|
|
}
|
|
return GetSmoCollectionResult<Schema>(urns, retValue, parentDatabase);
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlAsymmetricKeyQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(AsymmetricKey) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
Database parentDatabase = context.Parent as Database;
|
|
if (parentDatabase != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentDatabase.AsymmetricKeys.Refresh(true);
|
|
}
|
|
var retValue = parentDatabase.AsymmetricKeys;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentDatabase, filter, "AsymmetricKey");
|
|
}
|
|
return GetSmoCollectionResult<AsymmetricKey>(urns, retValue, parentDatabase);
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlCertificateQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(Certificate) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
Database parentDatabase = context.Parent as Database;
|
|
if (parentDatabase != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentDatabase.Certificates.Refresh(true);
|
|
}
|
|
var retValue = parentDatabase.Certificates;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentDatabase, filter, "Certificate");
|
|
}
|
|
return GetSmoCollectionResult<Certificate>(urns, retValue, parentDatabase);
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlSymmetricKeyQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(SymmetricKey) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
Database parentDatabase = context.Parent as Database;
|
|
if (parentDatabase != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentDatabase.SymmetricKeys.Refresh(true);
|
|
}
|
|
var retValue = parentDatabase.SymmetricKeys;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentDatabase, filter, "SymmetricKey");
|
|
}
|
|
return GetSmoCollectionResult<SymmetricKey>(urns, retValue, parentDatabase);
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlDatabaseEncryptionKeyQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(DatabaseEncryptionKey) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
Database parentDatabase = context.Parent as Database;
|
|
if (parentDatabase != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentDatabase.DatabaseEncryptionKey.Refresh();
|
|
}
|
|
var retValue = parentDatabase.DatabaseEncryptionKey;
|
|
if (retValue != null)
|
|
{
|
|
return new SqlSmoObject[] { retValue };
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlMasterKeyQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(MasterKey) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
Database parentDatabase = context.Parent as Database;
|
|
if (parentDatabase != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentDatabase.MasterKey.Refresh();
|
|
}
|
|
var retValue = parentDatabase.MasterKey;
|
|
if (retValue != null)
|
|
{
|
|
return new SqlSmoObject[] { retValue };
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlDatabaseAuditSpecificationQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(DatabaseAuditSpecification) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
Database parentDatabase = context.Parent as Database;
|
|
if (parentDatabase != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentDatabase.DatabaseAuditSpecifications.Refresh(true);
|
|
}
|
|
var retValue = parentDatabase.DatabaseAuditSpecifications;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentDatabase, filter, "DatabaseAuditSpecification");
|
|
}
|
|
return GetSmoCollectionResult<DatabaseAuditSpecification>(urns, retValue, parentDatabase);
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlSecurityPolicyQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(SecurityPolicy) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
Database parentDatabase = context.Parent as Database;
|
|
if (parentDatabase != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentDatabase.SecurityPolicies.Refresh(true);
|
|
}
|
|
var retValue = parentDatabase.SecurityPolicies;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentDatabase, filter, "SecurityPolicy");
|
|
}
|
|
return GetSmoCollectionResult<SecurityPolicy>(urns, retValue, parentDatabase);
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlDatabaseCredentialQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(DatabaseScopedCredential) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
Database parentDatabase = context.Parent as Database;
|
|
if (parentDatabase != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentDatabase.DatabaseScopedCredentials.Refresh(true);
|
|
}
|
|
var retValue = parentDatabase.DatabaseScopedCredentials;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentDatabase, filter, "DatabaseScopedCredential");
|
|
}
|
|
return GetSmoCollectionResult<DatabaseScopedCredential>(urns, retValue, parentDatabase);
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlRoleQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(DatabaseRole) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
Database parentDatabase = context.Parent as Database;
|
|
if (parentDatabase != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentDatabase.Roles.Refresh(true);
|
|
}
|
|
var retValue = parentDatabase.Roles;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentDatabase, filter, "DatabaseRole");
|
|
}
|
|
return GetSmoCollectionResult<DatabaseRole>(urns, retValue, parentDatabase);
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlApplicationRoleQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(ApplicationRole) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
Database parentDatabase = context.Parent as Database;
|
|
if (parentDatabase != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentDatabase.ApplicationRoles.Refresh(true);
|
|
}
|
|
var retValue = parentDatabase.ApplicationRoles;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentDatabase, filter, "ApplicationRole");
|
|
}
|
|
return GetSmoCollectionResult<ApplicationRole>(urns, retValue, parentDatabase);
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlColumnMasterKeyQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(ColumnMasterKey) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
Database parentDatabase = context.Parent as Database;
|
|
if (parentDatabase != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentDatabase.ColumnMasterKeys.Refresh(true);
|
|
}
|
|
var retValue = parentDatabase.ColumnMasterKeys;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentDatabase, filter, "ColumnMasterKey");
|
|
}
|
|
return GetSmoCollectionResult<ColumnMasterKey>(urns, retValue, parentDatabase);
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlColumnEncryptionKeyQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(ColumnEncryptionKey) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
Database parentDatabase = context.Parent as Database;
|
|
if (parentDatabase != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentDatabase.ColumnEncryptionKeys.Refresh(true);
|
|
}
|
|
var retValue = parentDatabase.ColumnEncryptionKeys;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentDatabase, filter, "ColumnEncryptionKey");
|
|
}
|
|
return GetSmoCollectionResult<ColumnEncryptionKey>(urns, retValue, parentDatabase);
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlServiceBrokerQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(ServiceBroker) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
Database parentDatabase = context.Parent as Database;
|
|
if (parentDatabase != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentDatabase.ServiceBroker.Refresh();
|
|
}
|
|
var retValue = parentDatabase.ServiceBroker;
|
|
if (retValue != null)
|
|
{
|
|
return new SqlSmoObject[] { retValue };
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlServiceQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(BrokerService) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
ServiceBroker parentServiceBroker = context.Parent as ServiceBroker;
|
|
if (parentServiceBroker != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentServiceBroker.Services.Refresh(true);
|
|
}
|
|
var retValue = parentServiceBroker.Services;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentServiceBroker, filter, "BrokerService");
|
|
}
|
|
return GetSmoCollectionResult<BrokerService>(urns, retValue, parentServiceBroker);
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlContractQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(ServiceContract) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
ServiceBroker parentServiceBroker = context.Parent as ServiceBroker;
|
|
if (parentServiceBroker != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentServiceBroker.ServiceContracts.Refresh(true);
|
|
}
|
|
var retValue = parentServiceBroker.ServiceContracts;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentServiceBroker, filter, "ServiceContract");
|
|
}
|
|
return GetSmoCollectionResult<ServiceContract>(urns, retValue, parentServiceBroker);
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlQueueQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(ServiceQueue) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
ServiceBroker parentServiceBroker = context.Parent as ServiceBroker;
|
|
if (parentServiceBroker != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentServiceBroker.Queues.Refresh(true);
|
|
}
|
|
var retValue = parentServiceBroker.Queues;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentServiceBroker, filter, "ServiceQueue");
|
|
}
|
|
return GetSmoCollectionResult<ServiceQueue>(urns, retValue, parentServiceBroker);
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlRemoteServiceBindingQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(RemoteServiceBinding) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
ServiceBroker parentServiceBroker = context.Parent as ServiceBroker;
|
|
if (parentServiceBroker != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentServiceBroker.RemoteServiceBindings.Refresh(true);
|
|
}
|
|
var retValue = parentServiceBroker.RemoteServiceBindings;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentServiceBroker, filter, "RemoteServiceBinding");
|
|
}
|
|
return GetSmoCollectionResult<RemoteServiceBinding>(urns, retValue, parentServiceBroker);
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlBrokerPriorityQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(BrokerPriority) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
ServiceBroker parentServiceBroker = context.Parent as ServiceBroker;
|
|
if (parentServiceBroker != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentServiceBroker.Priorities.Refresh(true);
|
|
}
|
|
var retValue = parentServiceBroker.Priorities;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentServiceBroker, filter, "BrokerPriority");
|
|
}
|
|
return GetSmoCollectionResult<BrokerPriority>(urns, retValue, parentServiceBroker);
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlMessageTypeQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(MessageType) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
ServiceBroker parentServiceBroker = context.Parent as ServiceBroker;
|
|
if (parentServiceBroker != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentServiceBroker.MessageTypes.Refresh(true);
|
|
}
|
|
var retValue = parentServiceBroker.MessageTypes;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentServiceBroker, filter, "MessageType");
|
|
}
|
|
return GetSmoCollectionResult<MessageType>(urns, retValue, parentServiceBroker);
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlExternalDataSourceQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(ExternalDataSource) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
Database parentDatabase = context.Parent as Database;
|
|
if (parentDatabase != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentDatabase.ExternalDataSources.Refresh(true);
|
|
}
|
|
var retValue = parentDatabase.ExternalDataSources;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentDatabase, filter, "ExternalDataSource");
|
|
}
|
|
return GetSmoCollectionResult<ExternalDataSource>(urns, retValue, parentDatabase);
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlExternalFileFormatQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(ExternalFileFormat) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
Database parentDatabase = context.Parent as Database;
|
|
if (parentDatabase != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentDatabase.ExternalFileFormats.Refresh(true);
|
|
}
|
|
var retValue = parentDatabase.ExternalFileFormats;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentDatabase, filter, "ExternalFileFormat");
|
|
}
|
|
return GetSmoCollectionResult<ExternalFileFormat>(urns, retValue, parentDatabase);
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlProcedureQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(StoredProcedure) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
Database parentDatabase = context.Parent as Database;
|
|
if (parentDatabase != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentDatabase.StoredProcedures.Refresh(true);
|
|
}
|
|
var retValue = parentDatabase.StoredProcedures;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentDatabase, filter, "StoredProcedure");
|
|
}
|
|
return GetSmoCollectionResult<StoredProcedure>(urns, retValue, parentDatabase);
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlExtendedStoredProcedureQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(ExtendedStoredProcedure) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
Database parentDatabase = context.Parent as Database;
|
|
if (parentDatabase != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentDatabase.ExtendedStoredProcedures.Refresh(true);
|
|
}
|
|
var retValue = parentDatabase.ExtendedStoredProcedures;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentDatabase, filter, "ExtendedStoredProcedure");
|
|
}
|
|
return GetSmoCollectionResult<ExtendedStoredProcedure>(urns, retValue, parentDatabase);
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlSubroutineParameterQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(Parameter) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
StoredProcedure parentStoredProcedure = context.Parent as StoredProcedure;
|
|
if (parentStoredProcedure != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentStoredProcedure.Parameters.Refresh(true);
|
|
}
|
|
var retValue = parentStoredProcedure.Parameters;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentStoredProcedure, filter, "Parameter");
|
|
}
|
|
return GetSmoCollectionResult<Parameter>(urns, retValue, parentStoredProcedure);
|
|
}
|
|
}
|
|
UserDefinedAggregate parentUserDefinedAggregate = context.Parent as UserDefinedAggregate;
|
|
if (parentUserDefinedAggregate != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentUserDefinedAggregate.Parameters.Refresh(true);
|
|
}
|
|
var retValue = parentUserDefinedAggregate.Parameters;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentUserDefinedAggregate, filter, "Parameter");
|
|
}
|
|
return GetSmoCollectionResult<Parameter>(urns, retValue, parentUserDefinedAggregate);
|
|
}
|
|
}
|
|
UserDefinedFunction parentUserDefinedFunction = context.Parent as UserDefinedFunction;
|
|
if (parentUserDefinedFunction != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentUserDefinedFunction.Parameters.Refresh(true);
|
|
}
|
|
var retValue = parentUserDefinedFunction.Parameters;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentUserDefinedFunction, filter, "Parameter");
|
|
}
|
|
return GetSmoCollectionResult<Parameter>(urns, retValue, parentUserDefinedFunction);
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlPartitionFunctionParameterQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(PartitionFunctionParameter) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
PartitionFunction parentPartitionFunction = context.Parent as PartitionFunction;
|
|
if (parentPartitionFunction != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentPartitionFunction.PartitionFunctionParameters.Refresh(true);
|
|
}
|
|
var retValue = parentPartitionFunction.PartitionFunctionParameters;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentPartitionFunction, filter, "PartitionFunctionParameter");
|
|
}
|
|
return GetSmoCollectionResult<PartitionFunctionParameter>(urns, retValue, parentPartitionFunction);
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
|
|
[Export(typeof(SmoQuerier))]
|
|
internal partial class SqlBuiltInTypeQuerier: SmoQuerier
|
|
{
|
|
Type[] supportedTypes = new Type[] { typeof(SystemDataType) };
|
|
|
|
public override Type[] SupportedObjectTypes { get { return supportedTypes; } }
|
|
|
|
public override IEnumerable<SqlSmoObject> Query(SmoQueryContext context, string filter, bool refresh)
|
|
{
|
|
Database parentDatabase = context.Parent as Database;
|
|
if (parentDatabase != null)
|
|
{
|
|
bool hasFilter = !string.IsNullOrEmpty(filter);
|
|
if (refresh)
|
|
{
|
|
parentDatabase.Parent.SystemDataTypes.Refresh(true);
|
|
}
|
|
var retValue = parentDatabase.Parent.SystemDataTypes;
|
|
if (retValue != null)
|
|
{
|
|
HashSet<string> urns = null;
|
|
if (hasFilter)
|
|
{
|
|
urns = GetUrns(context, parentDatabase.Parent, filter, "SystemDataType");
|
|
}
|
|
return GetSmoCollectionResult<SystemDataType>(urns, retValue, parentDatabase);
|
|
}
|
|
}
|
|
return Enumerable.Empty<SqlSmoObject>();
|
|
}
|
|
}
|
|
}
|
|
|