< Summary - ZhEaIsNsAaBn.Libraries coverage (affected: 23 packages)

Information
Line coverage
100%
Covered lines: 5
Uncovered lines: 0
Coverable lines: 5
Total lines: 52
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_EntityType()100%11100%
get_Item(...)100%11100%
KeysOf(...)100%11100%
KeysOf(...)100%11100%

File(s)

/home/runner/work/ZhEaIsNsAaBn.Libraries.V1/ZhEaIsNsAaBn.Libraries.V1/src/DataBasePackages/ZhEaIsNsAaBn.DbSeeder/Binding/SeedBoundTable.cs

#LineLine coverage
 1namespace ZhEaIsNsAaBn.DbSeeder;
 2
 3/// One table file bound to the EF model: columns resolved, values converted to provider values, managed fields found.
 4internal sealed class SeedBoundTable
 5{
 6    public required string File { get; init; }
 7
 8    public required SeedTable Table { get; init; }
 9
 10    public required SeedEntityRoles Roles { get; init; }
 11
 12    /// Managed fields the entity really maps (role → column).
 13    public required IReadOnlyDictionary<SeedRole, SeedColumn> Managed { get; init; }
 14
 15    public required IReadOnlyList<SeedColumn> UpsertColumns { get; init; }
 16
 17    public required IReadOnlyList<IReadOnlyList<object?>> UpsertRows { get; init; }
 18
 19    public required IReadOnlyList<IReadOnlyList<object?>> DeleteKeys { get; init; }
 20
 21    public required IReadOnlyList<IReadOnlyList<object?>> SoftDeleteKeys { get; init; }
 22
 23    public required IReadOnlyList<IReadOnlyList<object?>> RestoreKeys { get; init; }
 24
 25    /// The <c>Before</c> rows (data columns only), for rollback.
 26    public required IReadOnlyList<SeedColumn> BeforeColumns { get; init; }
 27
 28    public required IReadOnlyList<IReadOnlyList<object?>> BeforeRows { get; init; }
 29
 30    /// Foreign keys to the same table whose columns are all written (rows are levelled).
 31    public required IReadOnlyList<IForeignKey> SelfReferences { get; init; }
 32
 33    /// Whether the rows are matched on a business key (<c>MatchBy</c>) rather than the primary key.
 34    public required bool MatchesByBusinessKey { get; init; }
 35
 36
 885837    public IEntityType EntityType => Table.EntityType;
 38
 813239    public SeedColumn? this[ SeedRole role ] => Managed.GetValueOrDefault( role );
 40
 41
 42    /// The match-key text of each row of <paramref name="rows"/> (written with <paramref name="columns"/>).
 43    public IEnumerable<string> KeysOf( IReadOnlyList<SeedColumn> columns, IEnumerable<IReadOnlyList<object?>> rows )
 44    {
 69745        var indexes = Table.MatchColumns.Select( m => columns.Select( c => c.ColumnName ).ToList().IndexOf( m.ColumnName
 46
 69747        return rows.Select( r => SeedRowLevels.Key( r, indexes ) );
 48    }
 49
 50    /// The match-key text of key rows (values in <see cref="SeedTable.MatchColumns"/> order).
 21751    public IEnumerable<string> KeysOf( IEnumerable<IReadOnlyList<object?>> keyRows ) => keyRows.Select( r => SeedRowLeve
 52}