Adds the TData instances to the default C1 storage.
If the storage does not exist, then one is created.
This method triggers the events OnBeforeAdd and OnAfterAdd for each item in items
Namespace: Composite.DataAssembly: Composite (in Composite.dll) Version: 5.3.6135.33083
Syntax
C# |
---|
public IList<TData> Add<TData>( IEnumerable<TData> items ) where TData : class, IData |
Visual Basic |
---|
Public Function Add(Of TData As {Class, IData}) ( _ items As IEnumerable(Of TData) _ ) As IList(Of TData) |
Visual C++ |
---|
public: generic<typename TData> where TData : ref class, IData IList<TData>^ Add( IEnumerable<TData>^ items ) |
Parameters
- items
- Type: System.Collections.Generic..::..IEnumerable<(Of <(<'TData>)>)>
The data items to add
Type Parameters
- TData
- An IData interface
Return Value
The newly added data items. Note: These could differ from the items in itemsExamples
CopyC#
using (DataConnection connection = new DataConnection()) { List<IMyDataType> items = new List<IMyDataType>(); for (int i = 0; i < 10; i++) { IMyDataType myDataType = DataConnection.New<IMyDataType>(); myDataType.Name = "John Doe"; myDataType.Number = i; items.Add(myDataType); } connection.Add<IMyDataType>(items); }