combit List & Label 29 - .NET Help
combit.Reporting.DataProviders Namespace / ObjectDataProvider Class
Members Example

In This Topic
    ObjectDataProvider Class
    In This Topic

    This data provider can be used to access object structures. It is capable to work with the following types/interfaces:

    • IEnumerable (requires at least one record, though)
    • IEnumerable<T>
    • IListSource

    In order to influence the property names and types, you may either implement the ITypedList interface on your class or use the DisplayNameAttribute. To suppress members, use the Browsable(false) attribute on the members.

    The provider can parse empty enumerations as well as long as they are strongly typed. Otherwise, at least one element is required in the enumeration and this first element determines the type that is used for further parsing.

    The provider automatically supports sorting as soon as the data source implements the IBindingList interface.

    You may also use this data provider to access LINQ query results, as they are IEnumerable<T>.

    When using EntityCollection<T> objects as data source the ObjectDataProvider first checks the state of the sub relation by querying the IsLoaded property and dynamically calls Load() if necessary. This way, the data is only queried when needed.

    Object Model
    ObjectDataProvider Class
    Public NotInheritable Class ObjectDataProvider 
       Implements ICanHandleUsedIdentifiers, IDataProvider, combit.Reporting.ISupportsLogger 
    public sealed class ObjectDataProvider : ICanHandleUsedIdentifiers, IDataProvider, combit.Reporting.ISupportsLogger  
    public ref class ObjectDataProvider sealed : public ICanHandleUsedIdentifiers, IDataProvider, combit.Reporting.ISupportsLogger  
    class Car
        public string Brand { get; set; }
        public string Model { get; set; }
    List<Car> cars = new List<Car>();
    cars.Add(new Car { Brand = "VW", Model = "Passat"});
    cars.Add(new Car { Brand = "Porsche", Model = "Cayenne"});
    LL.DataSource = new ObjectDataProvider(cars);
    Class Car
    	Private m_Brand As String
    	Public Property Brand() As String
    			Return m_Brand
    		End Get
    			m_Brand = Value
    		End Set
    	End Property
    	Private m_Model As String
    	Public Property Model() As String
    			Return m_Model
    		End Get
    			m_Model = Value
    		End Set
    	End Property
    End Class
    Dim cars As New List(Of Car)()
    cars.Add(New Car() With {.Brand = "VW", .Model = "Passat"})
    cars.Add(New Car() With {.Brand = "Porsche", .Model = "Cayenne"})
    LL.DataSource = New ObjectDataProvider(cars)
    Inheritance Hierarchy



    Platforms: Windows 10 (Version 21H2 - 23H2), Windows 11 (21H2 - 22H2), Windows Server 2016 - 2022
    .NET: .NET Framework 4.8, .NET 6, .NET 7, .NET 8

    See Also