Skip to main content
A newer version of this page is available.

DataSourceRemovedEventArgs.IsDataSourceInternal Property

Gets whether the data source is internal (loaded with the document template or added in the UI using the Data Source Wizard) or external (added manually or used in other parts of the application).

Namespace: DevExpress.Snap

Assembly: DevExpress.Snap.v18.2.Core.dll

Declaration

public bool IsDataSourceInternal { get; }

Property Value

Type Description
Boolean

true, if the data source was loaded with the document template or added in the UI using the Data Source Wizard; otherwise, false.

Remarks

The IsDataSourceInternal property indicates whether the data source can be safely removed.

If the property returns true, the data source can be disposed of using the IDisposable.Dispose method. If false, additional examination is required.

The example below shows how to use this property to safely dispose of the data source.

Example

public Form1()
{
  InitializeComponent();
  this.snapControl1.Document.DataSources.DataSourceRemoved += OnDataSourceRemoved;
}     


void OnDataSourceRemoved(object sender, DevExpress.Snap.DataSourceRemovedEventArgs e)
{
  if (e.IsDataSourceInternal)
    {
     IDisposable disposable = e.DataSourceInfo.DataSource as IDisposable;
     if (disposable != null) { disposable.Dispose(); }
    }
 }
See Also