Search Results for

    Show / Hide Table of Contents

    Class DataSourceBase

    Base class for all datasources such as TableDataSource.

    Inheritance
    System.Object
    Base
    DataComponentBase
    Column
    DataSourceBase
    BusinessObjectDataSource
    TableDataSource
    ViewDataSource
    Implements
    IFRSerializable
    IParent
    Inherited Members
    Column.PropName
    Column.PropDescriptor
    Column.Columns
    Column.SetName(String)
    Column.GetExpressions()
    Column.CanContain(Base)
    Column.GetChildObjects(ObjectCollection)
    Column.AddChild(Base)
    Column.RemoveChild(Base)
    Column.GetChildOrder(Base)
    Column.SetChildOrder(Base, Int32)
    Column.UpdateLayout(Single, Single)
    DataComponentBase.Enabled
    DataComponentBase.ReferenceName
    DataComponentBase.Reference
    DataComponentBase.IsAliased
    DataComponentBase.Assign(Base)
    Base.Name
    Base.Restrictions
    Base.Flags
    Base.Parent
    Base.BaseName
    Base.ClassName
    Base.Report
    Base.Page
    Base.ChildObjects
    Base.AllObjects
    Base.ZOrder
    Base.IsAncestor
    Base.IsDesigning
    Base.IsPrinting
    Base.IsRunning
    Base.OriginalComponent
    Base.Disposed
    Base.SetProp(Base, Base)
    Base.FloatDiff(Single, Single)
    Base.DeserializeSubItems(FRReader)
    Base.ExtractDefaultMacros(String)
    Base.Dispose(Boolean)
    Base.Dispose()
    Base.SetFlags(Flags, Boolean)
    Base.SetReport(Report)
    Base.SetParent(Base)
    Base.SetParentCore(Base)
    Base.FindObject(String)
    Base.CreateUniqueName()
    Base.Clear()
    Base.BaseAssign(Base)
    Base.AssignAll(Base)
    Base.HasParent(Base)
    Base.HasFlag(Flags)
    Base.HasRestriction(Restrictions)
    Base.InvokeEvent(String, Object)
    Base.OnAfterLoad()
    Base.GetCustomScript()
    Base.ExtractMacros()
    Base.IsHaveToConvert(Object)
    Base.GetConvertedObjects()
    Base.ForEachAllConvectedObjects(Object)
    Namespace: FastReport.Data
    Assembly: FastReport.Base.dll
    Syntax
    public abstract class DataSourceBase : Column, IDisposable, IFRSerializable, IParent

    Constructors

    DataSourceBase()

    Initializes a new instance of the DataSourceBase class with default settings.

    Declaration
    public DataSourceBase()

    Fields

    currentRow

    Declaration
    protected object currentRow
    Field Value
    Type Description
    System.Object

    Properties

    Alias

    Gets or sets alias of this object.

    Declaration
    public string Alias { get; set; }
    Property Value
    Type Description
    System.String
    Remarks

    Alias is a human-friendly name of this object. It may contain any symbols (including spaces and national symbols).

    BindableControl

    This property is not relevant to this class.

    Declaration
    public ColumnBindableControl BindableControl { get; set; }
    Property Value
    Type Description
    ColumnBindableControl

    Calculated

    This property is not relevant to this class.

    Declaration
    public bool Calculated { get; set; }
    Property Value
    Type Description
    System.Boolean

    CurrentRow

    Gets the current data row.

    Declaration
    public object CurrentRow { get; }
    Property Value
    Type Description
    System.Object
    Remarks

    This property is updated when you call the Next() method.

    CurrentRowNo

    Gets an index of current data row.

    Declaration
    public int CurrentRowNo { get; set; }
    Property Value
    Type Description
    System.Int32
    Remarks

    You should initialize the datasource by the Init method before using this property.

    This property is updated when you call the Next() method.

    CustomBindableControl

    This property is not relevant to this class.

    Declaration
    public string CustomBindableControl { get; set; }
    Property Value
    Type Description
    System.String

    DataType

    This property is not relevant to this class.

    Declaration
    public Type DataType { get; set; }
    Property Value
    Type Description
    System.Type

    Expression

    This property is not relevant to this class.

    Declaration
    public string Expression { get; set; }
    Property Value
    Type Description
    System.String

    ForceLoadData

    Forces loading of data for this datasource.

    Declaration
    public bool ForceLoadData { get; set; }
    Property Value
    Type Description
    System.Boolean
    Remarks

    This property is false by default. Set it to true if you need to reload data each time when the datasource initialized. Note that this may slow down the performance.

    Format

    This property is not relevant to this class.

    Declaration
    public ColumnFormat Format { get; set; }
    Property Value
    Type Description
    ColumnFormat

    HasMoreRows

    Gets a value indicating that datasource has more rows, that is the CurrentRowNo is less than the RowCount.

    Declaration
    public bool HasMoreRows { get; }
    Property Value
    Type Description
    System.Boolean
    Remarks

    You should initialize the datasource by the Init method before using this property.

    Usually this property is used with the following code block:

    dataSource.Init();
    while (dataSource.HasMoreRows)
    {
      // do something...
      dataSource.Next();
    }

    Item[Column]

    Gets data stored in a specified column.

    Declaration
    public object this[Column column] { get; }
    Parameters
    Type Name Description
    Column column

    The column.

    Property Value
    Type Description
    System.Object

    The column's value.

    Remarks

    You should initialize the datasource by the Init method before using this property.

    Item[String]

    Gets data stored in a specified column.

    Declaration
    public object this[string columnAlias] { get; }
    Parameters
    Type Name Description
    System.String columnAlias

    Alias of a column.

    Property Value
    Type Description
    System.Object

    The column's value.

    Remarks

    You should initialize the datasource by the Init method before using this property.

    RowCount

    Gets a number of data rows in this datasource.

    Declaration
    public int RowCount { get; }
    Property Value
    Type Description
    System.Int32
    Remarks

    You should initialize the datasource by the Init method before using this property.

    Methods

    Deserialize(FRReader)

    Deserializes the object.

    Declaration
    public override void Deserialize(FRReader reader)
    Parameters
    Type Name Description
    FRReader reader

    Reader object.

    Overrides
    Base.Deserialize(FRReader)
    Remarks

    Do not call this method directly. You should override it if you are developing a new component for FastReport.

    This method is called when the object needs to restore the state. It may happen when:

    • loading the report from a file or stream;
    • loading the report from the designer's undo buffer;
    • assigning another object to this object using the Assign(Base) or AssignAll methods;
    • loading the object from the designer's clipboard;
    • loading the object from the preview pages.

    EnsureInit()

    Initializes the data source if it is not initialized yet.

    Declaration
    public void EnsureInit()

    First()

    Navigates to the first row.

    Declaration
    public void First()
    Remarks

    You should initialize the datasource by the Init method before using this method.

    GetValue(Column)

    Gets data stored in a specified column.

    Declaration
    protected abstract object GetValue(Column column)
    Parameters
    Type Name Description
    Column column

    The column.

    Returns
    Type Description
    System.Object

    An object that contains the data.

    GetValue(String)

    Gets data stored in a specified column.

    Declaration
    protected virtual object GetValue(string alias)
    Parameters
    Type Name Description
    System.String alias

    The column alias.

    Returns
    Type Description
    System.Object

    An object that contains the data.

    Init()

    Initializes this datasource.

    Declaration
    public void Init()
    Remarks

    This method fills the table with data. You should always call it before using most of datasource properties.

    Init(DataSourceBase)

    Initializes this datasource and filters data rows according to the master-detail relation between this datasource and parentData.

    Declaration
    public void Init(DataSourceBase parentData)
    Parameters
    Type Name Description
    DataSourceBase parentData

    Parent datasource.

    Remarks

    To use master-detail relation, you must define the Relation object that describes the relation, and add it to the Report.Dictionary.Relations collection.

    Init(DataSourceBase, String, SortCollection)

    Initializes this datasource and filters data rows according to the master-detail relation between this datasource and parentData. Also applies the specified filter and sorts the rows.

    Declaration
    public void Init(DataSourceBase parentData, string filter, SortCollection sort)
    Parameters
    Type Name Description
    DataSourceBase parentData

    Parent datasource.

    System.String filter

    The filter expression.

    SortCollection sort

    The collection of sort descriptors.

    Remarks

    To use master-detail relation, you must define the Relation object that describes the relation, and add it to the Report.Dictionary.Relations collection.

    Init(Relation, String, SortCollection)

    Initializes this datasource and filters data rows according to the master-detail relation. Also applies the specified filter and sorts the rows.

    Declaration
    public void Init(Relation relation, string filter, SortCollection sort)
    Parameters
    Type Name Description
    Relation relation

    The master-detail relation.

    System.String filter

    The filter expression.

    SortCollection sort

    The collection of sort descriptors.

    Remarks

    To use master-detail relation, you must define the Relation object that describes the relation, and add it to the Report.Dictionary.Relations collection.

    Init(String)

    Initializes this datasource and applies the specified filter.

    Declaration
    public void Init(string filter)
    Parameters
    Type Name Description
    System.String filter

    The filter expression.

    Init(String, SortCollection)

    Initializes this datasource, applies the specified filter and sorts the rows.

    Declaration
    public void Init(string filter, SortCollection sort)
    Parameters
    Type Name Description
    System.String filter

    The filter expression.

    SortCollection sort

    The collection of sort descriptors.

    InitializeComponent()

    Initializes the object before running a report.

    Declaration
    public override void InitializeComponent()
    Overrides
    DataComponentBase.InitializeComponent()
    Remarks

    This method is used by the report engine, do not call it directly.

    InitSchema()

    Initializes the datasource schema.

    Declaration
    public abstract void InitSchema()
    Remarks

    This method is used to support the FastReport.Net infrastructure. Do not call it directly.

    LoadData(ArrayList)

    Loads the datasource with data.

    Declaration
    public abstract void LoadData(ArrayList rows)
    Parameters
    Type Name Description
    System.Collections.ArrayList rows

    Rows to fill with data.

    Remarks

    This method is used to support the FastReport.Net infrastructure. Do not call it directly.

    Next()

    Navigates to the next row.

    Declaration
    public void Next()
    Remarks

    You should initialize the datasource by the Init method before using this method.

    Prior()

    Navigates to the prior row.

    Declaration
    public void Prior()
    Remarks

    You should initialize the datasource by the Init method before using this method.

    Serialize(FRWriter)

    Serializes the object.

    Declaration
    public override void Serialize(FRWriter writer)
    Parameters
    Type Name Description
    FRWriter writer

    Writer object.

    Overrides
    Column.Serialize(FRWriter)
    Remarks

    Do not call this method directly. You should override it if you are developing a new component for FastReport.

    This method is called when the object needs to save the state. It may happen when:

    • saving the report to the file or stream;
    • saving the report to the designer's undo buffer;
    • assigning the object to another object using the Assign(Base) or AssignAll methods;
    • saving the object to the designer's clipboard;
    • saving the object to the preview (when run a report).

    Events

    Load

    Occurs when the FastReport engine loads data source with data.

    Declaration
    public event EventHandler Load
    Event Type
    Type Description
    System.EventHandler
    Remarks

    Use this event if you want to implement load-on-demand. Event handler must load the data into the data object which this datasource is bound to (for example, the TableDataSource uses data from the DataTable object bound to the Table property).

    Implements

    IFRSerializable
    IParent
    Back to top © 1998-2025 Copyright Fast Reports Inc.