public VpaTableViewModel(VpaTable table, VertiPaqAnalyzerViewModel parentViewModel) { _table = table; _parentViewModel = parentViewModel; Columns = _table.Columns.Select(c => new VpaColumnViewModel(c, this)); ColumnMaxTotalSize = Columns.Max(c => c.TotalSize); ColumnsMaxCardinality = Columns.Max(c => c.ColumnCardinality); RelationshipsFrom = _table.RelationshipsFrom.Select(r => new VpaRelationshipViewModel(r, this)); if (RelationshipsFrom.Count() > 0) { RelationshipMaxFromCardinality = RelationshipsFrom.Max(r => r.FromColumnCardinality); RelationshipMaxToCardinality = RelationshipsFrom.Max(r => r.ToColumnCardinality); RelationshipFromMissingKeys = RelationshipsFrom.Sum(r => r.MissingKeys); } }
public VpaTableViewModel(VpaTable table, VertiPaqAnalyzerViewModel parentViewModel, VpaSort sort) { _table = table; _parentViewModel = parentViewModel; Columns = _table.Columns.Select(c => new VpaColumnViewModel(c, this)); if (Columns.Any()) { ColumnMaxTotalSize = Columns.Max(c => c.TotalSize); ColumnsMaxCardinality = Columns.Max(c => c.ColumnCardinality); } RelationshipsFrom = _table.RelationshipsFrom.Select(r => new VpaRelationshipViewModel(r, this)); if (RelationshipsFrom.Any()) { RelationshipMaxFromCardinality = RelationshipsFrom.Max(r => r.FromColumnCardinality); RelationshipMaxToCardinality = RelationshipsFrom.Max(r => r.ToColumnCardinality); RelationshipMaxOneToManyRatio = RelationshipsFrom.Max(r => r.OneToManyRatio); RelationshipFromMissingKeys = RelationshipsFrom.Sum(r => r.MissingKeys); RelationshipInvalidRows = RelationshipsFrom.Sum(r => r.InvalidRows); } _sort = sort; }