Partager via


ListProvider<TBusinessObject> Constructor ()

 

Initializes a new instance of the ListProvider<TBusinessObject> class.

Namespace:   Microsoft.WindowsServerSolutions.Administration.ObjectModel
Assembly:  Microsoft.WindowsServerSolutions.Administration.ObjectModel (in Microsoft.WindowsServerSolutions.Administration.ObjectModel.dll)

Syntax

protected ListProvider()
protected:
ListProvider()
Protected Sub New

Remarks

The code example for this constructor shows business objects that are created from a class that uses properties to make information available. Business objects can also be created from other sources, such as databases or services.

Do not display any type of user interface from the ListProvider<TBusinessObject> methods that are overridden in a user-defined class. Unexpected results can occur if you display user interface objects from these methods. For example, the user interface object can be hidden from view because it was displayed behind the Dashboard. When errors occur using these methods, use the Errors property to report the errors. To display a task-based user interface, use the AsyncAction delegate method of the AsyncUiTask object or the SyncAction delegate method of the SyncUiTask object.

Examples

The following code example shows how to define a class that inherits ListProvider<TBusinessObject> and contains a list of business objects:

class BusinessListProvider : ListProvider<BusinessObject>
{
    protected override void RefreshAndListenForUpdates(Ilist<BusinessObject> list)
    {
        BusinessObject businessObj = new BusinessObject();
        businessObj.AdminName = "administrator1";
        businessObj.ComputerName = "Computer1";
        businessObj.Location = "Building 1";
        businessObj.System = "Windows Vista";

        list.Add(businessObj);

        businessObj = new BusinessObject();
        businessObj.AdminName = "administrator2";
        businessObj.ComputerName = "Computer2";
        businessObj.Location = "Building 2";
        businessObj.System = "Windows Vista";

        list.Add(businessObj);
    }

    protected override string GetObjectDisplayName(BusinessObject businessObj)
    {
        return businessObj.System + " " + businessObj.ComputerName;
    }

    protected override string GetObjectId(BusinessObject businessObj)
    {
        return businessObj.ComputerName;
    }

    protected override void StopListeningForUpdates()
    {
    }
}

See Also

ListProvider<TBusinessObject> Class
Microsoft.WindowsServerSolutions.Administration.ObjectModel Namespace

Return to top