Export (0) Print
Expand All

DataSet.ShouldSerializeRelations Method

Gets a value indicating whether Relations property should be persisted.

[Visual Basic]
Protected Overridable Function ShouldSerializeRelations() As Boolean
[C#]
protected virtual bool ShouldSerializeRelations();
[C++]
protected: virtual bool ShouldSerializeRelations();
[JScript]
protected function ShouldSerializeRelations() : Boolean;

Return Value

true if the property value has been changed from its default; otherwise, false.

Remarks

You typically use this method if you are either creating a designer for the DataSet, or creating your own control incorporating the DataSet.

Example

[Visual Basic, C#, C++] The following examples shows a class derived from the DataSet class. The Reset and ShouldSerializeRelations methods are invoked from within functions in the derived class.

[Visual Basic] 
Public Class DerivedDataSet
    Inherits System.Data.DataSet
    
    Public Sub ResetDataSetRelations()
        ' Check the ShouldSerializeRelations methods 
        ' before invoking Reset.
        If Not Me.ShouldSerializeRelations() Then
            Me.Reset()
        End If
    End Sub
End Class

[C#] 
public  class DerivedDataSet:System.Data.DataSet {
   public void ResetDataSetRelations(){
      // Check the ShouldSerializeRelations methods 
      // before invoking Reset.
      if(!this.ShouldSerializeRelations()){
         this.Reset();
      }
   }
}

[C++] 
public  __gc class DerivedDataSet:public System::Data::DataSet {
public:
    void ResetDataSetRelations(){
       // Check the ShouldSerializeRelations methods 
       // before invoking Reset.
       if(!this->ShouldSerializeRelations()){
          this->Reset();
       }
    }
 };

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

See Also

DataSet Class | DataSet Members | System.Data Namespace

Show:
© 2014 Microsoft