Create a new TData that can be added using Add<(Of <<'(TData>)>>)(TData). This method triggers the event OnNew for the return value of the method.

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

Syntax

C#
public TData CreateNew<TData>()
where TData : class, IData
Visual Basic
Public Function CreateNew(Of TData As {Class, IData}) As TData
Visual C++
public:
generic<typename TData>
where TData : ref class, IData
TData CreateNew()

Type Parameters

TData
An IData interface

Return Value

Returns a new instance of the TData

Examples

CopyC#
using (DataConnection connection = new DataConnection())
{
   IMyDataType myDataType = connection.CreateNew<IMyDataType>();
   myDataType.Name = "John Doe";
   connection.Add<IMyDataType>(myDataType);        
}

See Also