public GridRendererContext( ImmutableGridRendererContext immutableGridRendererContext, IRendererTreeBuilder rendererTreeBuilder, ITableDataSet tableDataSet, FlexGridContext flexGridContext) { if (immutableGridRendererContext is null) { throw new ArgumentNullException(nameof(immutableGridRendererContext)); } RendererTreeBuilder = rendererTreeBuilder ?? throw new ArgumentNullException(nameof(RendererTreeBuilder)); TableDataSet = tableDataSet ?? throw new ArgumentNullException(nameof(tableDataSet)); FlexGridContext = flexGridContext ?? throw new ArgumentNullException(nameof(flexGridContext)); GridConfiguration = immutableGridRendererContext.GridConfiguration; GridItemProperties = immutableGridRendererContext.GridItemProperties; GridItemCollectionProperties = immutableGridRendererContext.GridEntityConfiguration.ClrTypeCollectionProperties; CssClasses = immutableGridRendererContext.CssClasses; PropertyValueAccessor = immutableGridRendererContext.GetPropertyValueAccessor; _gridEntityConfiguration = immutableGridRendererContext.GridEntityConfiguration; _valueFormatters = immutableGridRendererContext.ValueFormatters; _columnRendererFragments = immutableGridRendererContext.ColumnRendererFragments; _columnEditRendererBuilders = immutableGridRendererContext.ColumnEditRendererBuilders; _firstColumnName = GridItemProperties.First().Name; _lastColumnName = GridItemProperties.Last().Name; NumberOfColumns = GridItemProperties.Count + (immutableGridRendererContext.InlineEditItemIsAllowed() || immutableGridRendererContext.CreateItemIsAllowed() ? 1 : 0) + (GridConfiguration.IsMasterTable ? 1 : 0); }
private ImmutableGridRendererContext GetImmutableGridRendererContext(Type dataSetItemType) { if (_immutableRendererContextCache.TryGetValue(dataSetItemType, out var immutableGridRendererContext)) { return(immutableGridRendererContext); } var gridConfiguration = GridConfigurationProvider.FindGridEntityConfigurationByType(dataSetItemType); _propertyValueAccessorCache.AddPropertyAccessor(dataSetItemType, new TypeWrapper(dataSetItemType, _logger)); immutableGridRendererContext = new ImmutableGridRendererContext( gridConfiguration, _propertyValueAccessorCache.GetPropertyAccesor(dataSetItemType), _currentUserPermission); immutableGridRendererContext.InitializeGridProperties(dataSetItemType.GetProperties().ToList()); _immutableRendererContextCache.Add(dataSetItemType, immutableGridRendererContext); return(immutableGridRendererContext); }