This is the data item that is the subject of the event fired.

Namespace: Composite.Data
Assembly: Composite (in Composite.dll) Version: 6.1.6325.31818

Syntax

C#
public TData GetData<TData>()
where TData : IData
Visual Basic
Public Function GetData(Of TData As IData) As TData
Visual C++
public:
generic<typename TData>
where TData : IData
TData GetData()

Type Parameters

TData
An IData interface

Return Value

Returns a casted version of the data item that is the suvject of the event fired.

Examples

CopyC#
void MyMethod()
{
   DataEvents<IMyDataType>().OnBeforeAdd += new DataEventHandler(DataEvents_OnBeforeAdd);

   using (DataConnection connection = new DataConnection())
   {
      IMyDataType myDataType = DataConnection.New<IMyDataType>();
      myDataType.Name = "Foo";

      connection.Add<IMyDataType>(myDataType); // This will fire the event!
   }
}


void DataEvents_OnBeforeAdd(DataEventArgs dataEventArgs)
{        
   IMyDataType myDataType = dataEventArgs.GetData<IMyDataType>(); // This will be the myDataType instance just created
}

See Also