/// <summary> /// Disposes this instance. /// </summary> /// <param name="disposing"><c>true</c> when called from <see cref="Dispose()"/> method. <c>false</c> when called from finalizer.</param> protected virtual void Dispose(bool disposing) { if (disposing) { if (DataSource != null) { DataSource.Dispose(); DataSource = null; } } }
/// <summary> /// Create a new <see cref="ContentView"/> with given content, a content context, and a data source. /// This <see cref="ContentView"/> owns the data source and will dispose it when disposed. /// </summary> /// <param name="content">The initial content for the view.</param> /// <param name="contentContext">The content context this view represents.</param> /// <param name="dataSource">The data source to use.</param> public ContentView(IEnumerable<ContentItem> content, IContentContext contentContext, ICargoDataSource dataSource) { ContentContext = contentContext; Content = content.ToDictionary(x => x.Key); DataSource = dataSource; }
/// <summary> /// Disposes this instance. /// </summary> /// <param name="disposing"><c>true</c> when called from <see cref="Dispose()"/> method. <c>false</c> when called from finalizer.</param> protected virtual void Dispose(bool disposing) { if (disposing) { if(DataSource!= null) { DataSource.Dispose(); DataSource = null; } } }
/// <summary> /// Create a new <see cref="ContentView"/> with given content, a content context, and a data source. /// This <see cref="ContentView"/> owns the data source and will dispose it when disposed. /// </summary> /// <param name="content">The initial content for the view.</param> /// <param name="contentContext">The content context this view represents.</param> /// <param name="dataSource">The data source to use.</param> public ContentView(IEnumerable <ContentItem> content, IContentContext contentContext, ICargoDataSource dataSource) { ContentContext = contentContext; Content = content.ToDictionary(x => x.Key); DataSource = dataSource; }