A Sandcastle Documented Class Library

# IDataRetrievalService RetrieveBusinessDataAsync Method (ICollection ClientRequest )

Retrieves business data for MetricSet objects according to the specified requests.

Namespace: Dundas.BI.Data.DataRetrieval
Assembly: Dundas.BI.Core (in Dundas.BI.Core.dll) Version: 2.0.0.0 (10.0.0.1002)
Syntax
C#
VB
C++
F#
Copy

    ICollection<DataRetrievalContext> RetrieveBusinessDataAsync(
    	ICollection<ClientRequest> requests
    )

    Function RetrieveBusinessDataAsync (
    	requests As ICollection(Of ClientRequest)
    ) As ICollection(Of DataRetrievalContext)

    ICollection<DataRetrievalContext^>^ RetrieveBusinessDataAsync(
    	ICollection<ClientRequest^>^ requests
    )

    abstract RetrieveBusinessDataAsync :
            requests : ICollection<ClientRequest> -> ICollection<DataRetrievalContext>

#### Parameters

requests
  Type: System.Collections.Generic
  ICollection
  ClientRequest
  The requests.

#### Return Value

Type: ICollection
DataRetrievalContext
A collection of DataRetrievalContext objects corresponding to the requests.
Exceptions

Exception | Condition
--- | ---
ArgumentException | The requests was or empty.
InvalidSessionException | The caller context is not associated with a valid session.

Examples

This example demonstrates how to create the Dundas BI engine start the Dundas BI engine, log on, retrieve some data from a metric set, and then shutdown the Dundas BI engine.

C#
Copy

    using Dundas.BI;
    using Dundas.BI.AccountServices;
    using Dundas.BI.Services;
    using Dundas.BI.Data.DataRetrieval;
    using Dundas.BI.Data.Parameters;

       ...

    // Create the engine.
    EngineManager.CreateEngine(
        // Path to the application's data folder. Type: System.String
        @"C:\Program Files\Dundas Data Visualization Inc\Dundas BI\Instances\Instance1\www\BIWebsite\App_Data"
    );

    try
    {
        EngineManager.StartEngine();

        // Create a caller context not associated with any session.
        Engine.Current.GetService<ICallerContextService>().CreateAndSetCurrentContext(null);

        LogOnResult logOnResult = Engine.Current.GetService<ILogOnService>().LogOn(
            // The account name. Type: System.String
            "admin",
            // The password. Type: System.String
            "1234",
            // Delete other sessions for the logon to succeed. Type: System.Boolean
            true,
            // Culture to associate with the session, or null to use the default. Type: System.Globalization.CultureInfo
            null
        );

        // Set the current session ID.
        Engine.Current.GetService<ICallerContextService>().CurrentContext.SetCurrentSessionId(
            logOnResult.Session.Id
        );

        // Define a metric set ID.
        Guid metricSetId = new Guid("7f8f9aec-758a-4f1d-8e9d-542af346689c");

        // Get the data retrieval service
        IDataRetrievalService dataRetrievalService =
            Engine.Current.GetService<IDataRetrievalService>();

        var dataRetrivalContexts =
            dataRetrievalService.RetrieveBusinessDataAsync(
                new ClientRequest[]
                {
                    new ClientRequest(metricSetId, new Collection<ParameterValue>(), string.Empty)
                }
            );

        // Only have one data retrival request;
        DataRetrievalContext dataRetrivalContext =
            dataRetrivalContexts.First();

        // Wait for the data retrival to finish.
        dataRetrivalContext.ResultTask.Wait();

        // The data.
        DataCellSet dataCellSet = dataRetrivalContext.Result.Cellset;

    }
    finally
    {
            // Shutdown the engine.
        EngineManager.ShutdownEngine();
    }

See Also

#### Reference

IDataRetrievalService Interface
RetrieveBusinessDataAsync Overload
Dundas.BI.Data.DataRetrieval Namespace