共用方式為


Session Class

Definition

Session is the main object user code interacts with. A Session object represents a row in sys.server_event_sessions and also includes some data from sys.dm_xe_sessions if it's started.

public sealed class Session : Microsoft.SqlServer.Management.Sdk.Sfc.SfcInstance, Microsoft.SqlServer.Management.Common.IAlterable, Microsoft.SqlServer.Management.Common.ICreatable, Microsoft.SqlServer.Management.Common.IDroppable, Microsoft.SqlServer.Management.Sdk.Sfc.ISfcAlterable, Microsoft.SqlServer.Management.Sdk.Sfc.ISfcCreatable, Microsoft.SqlServer.Management.Sdk.Sfc.ISfcDroppable, Microsoft.SqlServer.Management.Sdk.Sfc.ISfcValidate
type Session = class
    inherit SfcInstance
    interface ISfcCreatable
    interface ICreatable
    interface ISfcAlterable
    interface IAlterable
    interface ISfcDroppable
    interface IDroppable
    interface ISfcValidate
    interface ISfcDiscoverObject
Public NotInheritable Class Session
Inherits SfcInstance
Implements IAlterable, ICreatable, IDroppable, ISfcAlterable, ISfcCreatable, ISfcDroppable, ISfcValidate
Inheritance
Implements

Constructors

Session()

Default constructor

Session(BaseXEStore, String)

Mostly used constructor

Fields

AutoStartProperty

AutoStart

DefaultDispatchLatency

Default dispatch latency is 30 seconds.

DefaultMaxMemory

The maximum amount of memeory by default is 4 MB.

EventRetentionModeProperty

EventRetentionMode

InfiniteDispatchLatency

0 indicates that dispatch latency is infinite.

MaxDispatchLatencyProperty

MaxDispatchLatency

MaxEventSizeProperty

MaxEventSize

MaxMemoryProperty

MaxMemory

MemoryPartitionModeProperty

MemoryPartitionMode

NotStarted

Session is currently not running.

TrackCausalityProperty

TrackCausality

TypeTypeName

Type name

Properties

AbstractIdentityKey (Inherited from SfcInstance)
AutoStart

Gets or sets a value indicating whether [auto start].

EventRetentionMode

Gets or sets the event retention mode.

Events

Gets the event collection.

ID

Gets the ID.

IdentityKey

Gets the identity key.

IsRunning

Gets a value indicating whether this session is running.

KeyChain

Returns the identity path of the object

(Inherited from SfcInstance)
MaxDispatchLatency

Gets or sets the max dispatch latency (in seconds).

MaxEventSize

Gets or sets the size (in KB) of the max event.

MaxMemory

Gets or sets the max memory (in KB).

MemoryPartitionMode

Gets or sets the memory partition mode.

Metadata (Inherited from SfcInstance)
Name

The name of the Session

Parent

Gets or sets the parent.

Properties (Inherited from SfcInstance)
PropertyStorageProvider

This property returns the default implementation of SFC for ISfcPropertyStorageProvider interface, it can be overriden in the child classes to return another storage provider (i.e. flat properties list)

(Inherited from SfcInstance)
StartTime

Gets the start time.

State

State of the object, used in Alter function in session.

Targets
TrackCausality

Gets or sets a value indicating whether [track causality].

Urn

Create a new Urn string on each request and return it.

(Inherited from SfcInstance)

Methods

AddEvent(EventInfo)

New an event and add it to this session.

AddEvent(String)

New an event from fully qualified event name and add it to this session.

AddTarget(String)

New a target from fully qualified target name and add it to this session .

AddTarget(TargetInfo)

New a target and add it to this session.

Alter()

Alter the session in the back-end server.

AlterImpl() (Inherited from SfcInstance)
CheckObjectCreated()

To be called from domain for when an API requires the object to be Created Stronger than CheckObjectState

(Inherited from SfcInstance)
CheckObjectState()

To be called from domain for any access to the object

(Inherited from SfcInstance)
Create()

Create the session in the back-end server.

CreateIdentityKey() (Inherited from SfcInstance)
CreateImpl() (Inherited from SfcInstance)
Discover(ISfcDependencyDiscoveryObjectSink) (Inherited from SfcInstance)
Drop()

Drop the session in the back-end server.

DropImpl() (Inherited from SfcInstance)
GetChildCollection(String)

Get the child collection in this instance for the given element name string.

(Inherited from SfcInstance)
GetDomain() (Inherited from SfcInstance)
GetObjectFactory()

Gets the object factory.

GetPropertySet() (Inherited from SfcInstance)
GetTypeMetadataImpl() (Inherited from SfcInstance)
InitializeUIPropertyState()

Overridable from the child objects who care about initializing their states (dynamic metadata which is currently the ".Enabled" property)

(Inherited from SfcInstance)
MarkForDropImpl(Boolean) (Inherited from SfcInstance)
MarkRootAsConnected() (Inherited from SfcInstance)
MoveImpl(SfcInstance) (Inherited from SfcInstance)
OnPropertyMetadataChanges(SfcPropertyMetadataChangedEventArgs) (Inherited from SfcInstance)
OnPropertyValueChanges(PropertyChangedEventArgs) (Inherited from SfcInstance)
PostAlter(Object) (Inherited from SfcInstance)
PostCreate(Object) (Inherited from SfcInstance)
PostDrop(Object) (Inherited from SfcInstance)
PostMove(Object) (Inherited from SfcInstance)
PostRename(Object) (Inherited from SfcInstance)
Refresh()

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

(Inherited from SfcInstance)
RemoveEvent(Event)

Removes the event object from the session.

RemoveTarget(Target)

Removes the target object from this session.

RenameImpl(SfcKey) (Inherited from SfcInstance)
ResetKey() (Inherited from SfcInstance)
ScriptAlter()

Script alter for this session.

ScriptCreate()

Script create for this session.

ScriptDrop()

Scripts drop for this session

Serialize(XmlWriter) (Inherited from SfcInstance)
Start()

Starts this session.

Stop()

Stops this session.

ToString() (Inherited from SfcInstance)
UpdateUIPropertyState() (Inherited from SfcInstance)
Validate()

Basic child object's validation

(Inherited from SfcInstance)
Validate(String)

Validates the specified method name.

Validate(String, Object[])

Validates the specified method name.

Events

propertyChanged (Inherited from SfcInstance)
PropertyChanged (Inherited from SfcInstance)
propertyMetadataChanged (Inherited from SfcInstance)
PropertyMetadataChanged (Inherited from SfcInstance)

Explicit Interface Implementations

ISfcDiscoverObject.Discover(ISfcDependencyDiscoveryObjectSink)

Applies to