SqlSmoObject SqlSmoObject SqlSmoObject Class

Definition

Contains common functionality for all the instance classes

[System.ComponentModel.TypeConverter(typeof(Microsoft.SqlServer.Management.Sdk.Sfc.LocalizableTypeConverter))]
public abstract class SqlSmoObject : Microsoft.SqlServer.Management.Smo.SmoObjectBase, Microsoft.SqlServer.Management.Common.IRefreshable, Microsoft.SqlServer.Management.Sdk.Sfc.IAlienObject, Microsoft.SqlServer.Management.Sdk.Sfc.ISfcPropertyProvider, System.ComponentModel.INotifyPropertyChanged
type SqlSmoObject = class
    inherit SmoObjectBase
    interface ISfcPropertyProvider
    interface ISfcNotifyPropertyMetadataChanged
    interface INotifyPropertyChanged
    interface IRefreshable
    interface IAlienObject
Public MustInherit Class SqlSmoObject
Inherits SmoObjectBase
Implements IAlienObject, INotifyPropertyChanged, IRefreshable, ISfcPropertyProvider
Inheritance
SqlSmoObjectSqlSmoObjectSqlSmoObject
Derived
Attributes
Implements

Constructors

SqlSmoObject() SqlSmoObject() SqlSmoObject()

Fields

m_ExtendedProperties m_ExtendedProperties m_ExtendedProperties
singletonParent singletonParent singletonParent

Regular SMO objects access the parent class reference through parentColl (corresponding collection in parent class). Singleton class has no collection in parent.

Properties

DatabaseEngineEdition DatabaseEngineEdition DatabaseEngineEdition

Returns the DatabaseEngineEdition of the SMO object

DatabaseEngineType DatabaseEngineType DatabaseEngineType

Returns the DatabaseEngineType of the SMO object

ExecuteForScalar ExecuteForScalar ExecuteForScalar
ExecutionManager ExecutionManager ExecutionManager
IsTouched IsTouched IsTouched

Whether the object has been touched for unconditional scripting of Alter

ObjectInSpace ObjectInSpace ObjectInSpace
Properties Properties Properties
ScalarResult ScalarResult ScalarResult
State State State

Returns the state of the object

(Inherited from SmoObjectBase)
Urn Urn Urn

Returns the Urn of the object, computed on the fly

UserData UserData UserData Inherited from SmoObjectBase

Methods

AddDatabaseContext(StringCollection) AddDatabaseContext(StringCollection) AddDatabaseContext(StringCollection)

method get called from the create script related method (from derived classes like Table, Index etc..)

AlterImpl() AlterImpl() AlterImpl()
AlterImplWorker() AlterImplWorker() AlterImplWorker()
BindDefaultImpl(String, String, Boolean) BindDefaultImpl(String, String, Boolean) BindDefaultImpl(String, String, Boolean)
BindRuleImpl(String, String, Boolean) BindRuleImpl(String, String, Boolean) BindRuleImpl(String, String, Boolean)
CheckObjectState() CheckObjectState() CheckObjectState()
CheckObjectState(Boolean) CheckObjectState(Boolean) CheckObjectState(Boolean)

This is a virtual function, so that derived classes can override it if they want to do additional checks on the state of the object

CheckObjectStateImpl(Boolean) CheckObjectStateImpl(Boolean) CheckObjectStateImpl(Boolean)

Checks object state Because it is not recusrive, this function can be called directly and which means derived classes can't supply their own validation

CleanObject() CleanObject() CleanObject()
CreateImpl() CreateImpl() CreateImpl()
CreateOrAlterImpl() CreateOrAlterImpl() CreateOrAlterImpl()
Discover() Discover() Discover()

Best Effort Discovery mechanism : This method reflects upon metadata and gets all available objects

DropImpl(Boolean) DropImpl(Boolean) DropImpl(Boolean)

drops the object

DropImplWorker(Urn, Boolean) DropImplWorker(Urn, Boolean) DropImplWorker(Urn, Boolean)

drops the object

ExecuteNonQuery(StringCollection, Boolean, Boolean) ExecuteNonQuery(StringCollection, Boolean, Boolean) ExecuteNonQuery(StringCollection, Boolean, Boolean)

Executes sql statements

ExecuteWithModes(SqlExecutionModes, Action) ExecuteWithModes(SqlExecutionModes, Action) ExecuteWithModes(SqlExecutionModes, Action)

Executes the given action under the given execution modes.

Resets the original modes after the action completes or fails.

FormatSqlVariant(Object) FormatSqlVariant(Object) FormatSqlVariant(Object)
GenerateAlterEvent() GenerateAlterEvent() GenerateAlterEvent()
GenerateAlterEvent(Urn, Object) GenerateAlterEvent(Urn, Object) GenerateAlterEvent(Urn, Object)
GetChildType(String, String) GetChildType(String, String) GetChildType(String, String)
GetContextDB() GetContextDB() GetContextDB()
GetDBName() GetDBName() GetDBName()
GetFragOptionString(FragmentationOption) GetFragOptionString(FragmentationOption) GetFragOptionString(FragmentationOption)
GetPropValue(String) GetPropValue(String) GetPropValue(String)

Retrieve the property value from :

  • The property bag directly if property is available (dirty or retrieved)
  • A call to our OnPropertyMissing method otherwise

    Will throw an exception if the property value is NULL in either case.

GetPropValueOptional(String) GetPropValueOptional(String) GetPropValueOptional(String)

Retrieve the property value from :

  • The property bag if the state is creating or we're in Design Mode (possible NULL value)
  • A call to our OnPropertyMissing method otherwise (will throw exception if value is NULL)
GetPropValueOptionalAllowNull(String) GetPropValueOptionalAllowNull(String) GetPropValueOptionalAllowNull(String)

Retrieve the property value from :

  • The property bag if the state is creating or we're in Design Mode (possible NULL)
  • A call to our OnPropertyMissing method otherwise (possible NULL)
GetRealValue(Property, Object) GetRealValue(Property, Object) GetRealValue(Property, Object)

Returns the real value for the property.

GetServerName() GetServerName() GetServerName()
GetServerObject() GetServerObject() GetServerObject()
GetSqlServerVersionName() GetSqlServerVersionName() GetSqlServerVersionName()

Gets the sqlserver public name for the current connection, e.g: will transfer "SQLTOOLS2008-2" to "SQL Server 2008".

GetTypeFromUrnSkeleton(Urn) GetTypeFromUrnSkeleton(Urn) GetTypeFromUrnSkeleton(Urn)
GetUrnRecursive(StringBuilder) GetUrnRecursive(StringBuilder) GetUrnRecursive(StringBuilder)

Computes the Urn for the object.

GetUrnRecursive(StringBuilder, UrnIdOption) GetUrnRecursive(StringBuilder, UrnIdOption) GetUrnRecursive(StringBuilder, UrnIdOption)

Computes the Urn for the object, potentially including other fields in the definition besides the key fields.

ImplInitialize(String[], OrderBy[]) ImplInitialize(String[], OrderBy[]) ImplInitialize(String[], OrderBy[])
Initialize() Initialize() Initialize()
Initialize(Boolean) Initialize(Boolean) Initialize(Boolean)

Initializes the object, by reading its properties from the enumerator

IsCollectionDirty(ICollection) IsCollectionDirty(ICollection) IsCollectionDirty(ICollection)
IsExpressSku() IsExpressSku() IsExpressSku()

Returns whether the server containing this object is an Express SKU

IsObjectDirty() IsObjectDirty() IsObjectDirty()
IsObjectInitialized() IsObjectInitialized() IsObjectInitialized()
IsObjectInSpace() IsObjectInSpace() IsObjectInSpace()
IsSupportedOnSqlAzure(Type) IsSupportedOnSqlAzure(Type) IsSupportedOnSqlAzure(Type)

Returns whether a smo object type is supported on Microsoft Azure SQL Database.

IsSupportedProperty(String) IsSupportedProperty(String) IsSupportedProperty(String)

Validate whether the specified property is supported in current server environment

IsVersion80SP3() IsVersion80SP3() IsVersion80SP3()
IsVersion90AndAbove() IsVersion90AndAbove() IsVersion90AndAbove()
MakeSqlString(String) MakeSqlString(String) MakeSqlString(String)

Returns a fully-escaped SQL string wrapped within the SQL string single-quotes

MarkDropped() MarkDropped() MarkDropped()
MarkForDropImpl(Boolean) MarkForDropImpl(Boolean) MarkForDropImpl(Boolean)
PostAlter() PostAlter() PostAlter()

this function is meant to be overriden by derived classes, if they have to do supplimentary actions after altering the object

PostCreate() PostCreate() PostCreate()

this function is meant to be overriden by derived classes, if they have to do supplimentary actions after object creation

PostDrop() PostDrop() PostDrop()

this function is meant to be overriden by derived classes, if they have to do supplimentary actions after dropping the object

QuoteString(String, Char, Char) QuoteString(String, Char, Char) QuoteString(String, Char, Char)

Return name enclosing with delimiters.

Refresh() Refresh() Refresh()

refreshes the object's properties by reading them from the server

ScriptImpl() ScriptImpl() ScriptImpl()
ScriptImpl(ScriptingOptions) ScriptImpl(ScriptingOptions) ScriptImpl(ScriptingOptions)

Returns a StringCollection object with the script for the object. This method throws an error if ScriptData is true

SetAccessToken(IRenewableToken) SetAccessToken(IRenewableToken) SetAccessToken(IRenewableToken)

Set the accessToken for connection.

SetParentImpl(SqlSmoObject) SetParentImpl(SqlSmoObject) SetParentImpl(SqlSmoObject)
SqlString(String) SqlString(String) SqlString(String)

Escapes all single-quotes in a string

ThrowIfAboveVersion100(String) ThrowIfAboveVersion100(String) ThrowIfAboveVersion100(String)

Throws an exception if the ServerVersion major version for this object is above 10.0 (SQL 2008)

ThrowIfAboveVersion80(String) ThrowIfAboveVersion80(String) ThrowIfAboveVersion80(String)

Throws an exception if the ServerVersion major version for this object is above 8.0 (SQL 2000)

ThrowIfBelowVersion100(String) ThrowIfBelowVersion100(String) ThrowIfBelowVersion100(String)

Throws an exception if the ServerVersion major version for this object is below 10.0 (SQL 2008)

ThrowIfBelowVersion110(String) ThrowIfBelowVersion110(String) ThrowIfBelowVersion110(String)

Throws an UnsupportedVersionException if either the source or destination server is below 11.0 (SQL 2012)

ThrowIfBelowVersion110Prop(String) ThrowIfBelowVersion110Prop(String) ThrowIfBelowVersion110Prop(String)

Throws an exception with text saying the specified property is not supported if the ServerVersion major version for this object is below 11.0 (SQL 2012)

ThrowIfBelowVersion120(String) ThrowIfBelowVersion120(String) ThrowIfBelowVersion120(String)

Throws an exception if the ServerVersion major version for this object is below 12.0 (SQL 2014)

ThrowIfBelowVersion120Prop(String) ThrowIfBelowVersion120Prop(String) ThrowIfBelowVersion120Prop(String)

Throws an exception with text saying the specified property is not supported if the ServerVersion major version for this object is below 12.0 (SQL 2014)

ThrowIfBelowVersion130(String) ThrowIfBelowVersion130(String) ThrowIfBelowVersion130(String)

Throws an exception if the ServerVersion major version for this object is below 13.0 (SQL 2016)

ThrowIfBelowVersion130Prop(String) ThrowIfBelowVersion130Prop(String) ThrowIfBelowVersion130Prop(String)

Throws an exception with text saying the specified property is not supported if the ServerVersion major version for this object is below 13.0 (SQL 2016)

ThrowIfBelowVersion140(String) ThrowIfBelowVersion140(String) ThrowIfBelowVersion140(String)

Throws an exception if the ServerVersion major version for this object is below 14.0 (SQL 2017)

ThrowIfBelowVersion140Prop(String) ThrowIfBelowVersion140Prop(String) ThrowIfBelowVersion140Prop(String)

Throws an exception with text saying the specified property is not supported if the ServerVersion major version for this object is below 14.0 (SQL 2017)

ThrowIfBelowVersion80(String) ThrowIfBelowVersion80(String) ThrowIfBelowVersion80(String)

Throws an exception if the ServerVersion major version for this object is below 8.0 (SQL 2000)

ThrowIfBelowVersion80SP3() ThrowIfBelowVersion80SP3() ThrowIfBelowVersion80SP3()

Throws an exception if the ServerVersion for this object is below 8.760 (8.0 SP3)

ThrowIfBelowVersion90(String) ThrowIfBelowVersion90(String) ThrowIfBelowVersion90(String)

Throws an exception if the ServerVersion major version for this object is below 9.0 (SQL 2005)

ToString() ToString() ToString()
Touch() Touch() Touch()

Mark the object "touched" for unconditional scripting of Alter.

TouchImpl() TouchImpl() TouchImpl()

Virtual method to allow derived classes to do additional work when touched.

Trace(String) Trace(String) Trace(String)
UnbindDefaultImpl(Boolean) UnbindDefaultImpl(Boolean) UnbindDefaultImpl(Boolean)
UnbindRuleImpl(Boolean) UnbindRuleImpl(Boolean) UnbindRuleImpl(Boolean)
UpdateCollectionState2(ICollection) UpdateCollectionState2(ICollection) UpdateCollectionState2(ICollection)
Validate(String, Object[]) Validate(String, Object[]) Validate(String, Object[]) Inherited from SmoObjectBase

Events

PropertyChanged PropertyChanged PropertyChanged
PropertyMetadataChanged PropertyMetadataChanged PropertyMetadataChanged

Explicit Interface Implementations

IAlienObject.Discover() IAlienObject.Discover() IAlienObject.Discover()
IAlienObject.GetDomainRoot() IAlienObject.GetDomainRoot() IAlienObject.GetDomainRoot()
IAlienObject.GetParent() IAlienObject.GetParent() IAlienObject.GetParent()
IAlienObject.GetPropertyType(String) IAlienObject.GetPropertyType(String) IAlienObject.GetPropertyType(String)

Discovers type of property.

IAlienObject.GetPropertyValue(String, Type) IAlienObject.GetPropertyValue(String, Type) IAlienObject.GetPropertyValue(String, Type)

Retrieves value for a given property. Throws if property is not found.

IAlienObject.GetUrn() IAlienObject.GetUrn() IAlienObject.GetUrn()
IAlienObject.Resolve(String) IAlienObject.Resolve(String) IAlienObject.Resolve(String)
IAlienObject.SetObjectState(SfcObjectState) IAlienObject.SetObjectState(SfcObjectState) IAlienObject.SetObjectState(SfcObjectState)

Sets state of this object based on provided SfcObjectState.

IAlienObject.SetPropertyValue(String, Type, Object) IAlienObject.SetPropertyValue(String, Type, Object) IAlienObject.SetPropertyValue(String, Type, Object)

Sets the value of given property, if it is writable. If property is not in property bag, reflection is used. Throws exception if the property is not found.

ISfcPropertyProvider.GetPropertySet() ISfcPropertyProvider.GetPropertySet() ISfcPropertyProvider.GetPropertySet()

Applies to