List & Label .NET
combit.Reporting.DataProviders Namespace / ObjectDataProvider Class
Members


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

    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
    Syntax
    'Declaration
     
    
    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  
    Remarks

    The following options are available to influence the individual properties of the class:

    • Implement the ITypedList interface in the class to be able to determine names and types implement
    • Use the DisplayName attribute for the name
    • Use the FieldType attribute for the type
    • Use the Browsable(false) attribute to suppress properties
    Example
    class Car
    {
        public string Brand { get; set; }
        public string Model { get; set; }
       
        [FieldType(LlFieldType.PDF)]
        public string FactSheet { get; set; }
       
        [Browsable(false)]
        public double Discount { get; set; }
    }
    
    List<Car> cars = new List<Car>();
    cars.Add(new Car { Brand = "VW", Model = "Passat", FactSheet = @"c:\temp\VWPassatSheet.pdf", Discount = 10});
    cars.Add(new Car { Brand = "Porsche", Model = "Cayenne", FactSheet = @"c:\temp\PorscheCayenneSheet.pdf", Discount = 15});
    
    LL.DataSource = new ObjectDataProvider(cars);
    LL.Design();
    
    Inheritance Hierarchy

    System.Object
       combit.Reporting.DataProviders.ObjectDataProvider

    Requirements

    Platforms: Windows 10 (Version 21H2 - 22H2), Windows 11 (22H2 - 25H2), Windows Server 2016 - 2025
    .NET: .NET Framework 4.8, .NET 8, .NET 9, .NET 10

    See Also