Classe NamedSet

Represents a named set for a given cube.

Espace de noms :  Microsoft.AnalysisServices.AdomdClient
Assembly :  Microsoft.AnalysisServices.AdomdClient (dans Microsoft.AnalysisServices.AdomdClient.dll)

Syntaxe

'Déclaration
Public NotInheritable Class NamedSet _
    Implements IMetadataObject
'Utilisation
Dim instance As NamedSet
public sealed class NamedSet : IMetadataObject
public ref class NamedSet sealed : IMetadataObject
[<SealedAttribute>]
type NamedSet =  
    class
        interface IMetadataObject
    end
public final class NamedSet implements IMetadataObject

Notes

A named set is a persisted set expression, which is associated with an alias and defined as part of the structure of a cube. In Multidimensional Expressions (MDX), a set expression can be a lengthy and complex declaration. A named set makes it easier to manage a set expression that is used regularly in MDX or XML for Analysis queries that involve the cube and provides a way of maintaining the set expression independently of the queries that use it.

A NamedSet encapsulates the alias and set expression of a named set, so that the metadata of the named set can be examined and incorporated into queries.

Exemples

The following subroutine, given a CubeDef, iterates through the NamedSets collection and displays information about each NamedSet in the collection:

Public Sub ListNamedSets(ByRef CubeToCheck As CubeDef)

    ' Check the parameter before performing actions on it.
    If CubeToCheck Is Nothing Then
        Throw New System.ArgumentNullException("CubeToCheck")
    Else
        ' Iterate through the NamedSets collection of the
        ' CubeDef object.

        Try
            Dim nsetToCheck As NamedSet

            Debug.WriteLine("Found " & CubeToCheck.NamedSets.Count & _
                " named set(s) in cube:")

            For Each nsetToCheck In CubeToCheck.NamedSets
                Debug.WriteLine("Named Set:  " & nsetToCheck.Name)
                Debug.WriteLine("    Description:  " & _
                    nsetToCheck.Description)
                Debug.WriteLine("    Expression:   " & _
                    nsetToCheck.Expression)
            Next
        Catch ex As AdomdConnectionException
            ' The connection could not be opened or was disconnected.
            ' This error can occur at any time, if the provider is 
            ' disconnected from the server.
            Debug.WriteLine(ex)
            Throw ex
        Catch ex As AdomdErrorResponseException
            ' A response is received from a provider which indicates an error.
            Debug.WriteLine(ex)
            Throw ex
        Catch ex As AdomdUnknownResponseException
            ' A response has been returned from the provider that 
            ' was not understood.
            Debug.WriteLine(ex)
            Throw ex
        Catch ex As AdomdCacheExpiredException
            ' A cached version of an ADOMD.NET object is no longer valid.
            ' This error is typically raised when reviewing metadata.
            Debug.WriteLine(ex)
            Throw ex
        Catch ex As AdomdException
            ' Any other error raised by ADOMD.NET.
            Debug.WriteLine(ex)
            Throw ex
        Catch ex As Exception
            ' Any other error.
            Debug.WriteLine(ex)
            Throw ex
        End Try
    End If
End Sub

Hiérarchie d'héritage

System. . :: . .Object
  Microsoft.AnalysisServices.AdomdClient..::..NamedSet

Sécurité des threads

Tous les membres publics static (Shared dans Visual Basic) de ce type sont thread-safe. Il n'est pas garanti que les membres d'instance soient thread-safe.