< Summary - Combined Code Coverage

Information
Class: NLightning.Infrastructure.Persistence.Contexts.NLightningDbContext
Assembly: NLightning.Infrastructure.Persistence
File(s): /home/runner/work/NLightning/NLightning/src/NLightning.Infrastructure.Persistence/Contexts/NLightningDbContext.cs
Tag: 57_24045730253
Line coverage
0%
Covered lines: 0
Uncovered lines: 23
Coverable lines: 23
Total lines: 58
Line coverage: 0%
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
.ctor(...)100%210%
get_BlockchainStates()100%210%
get_WatchedTransactions()100%210%
get_WalletAddresses()100%210%
get_Utxos()100%210%
get_Channels()100%210%
get_ChannelConfigs()100%210%
get_ChannelKeySets()100%210%
get_Htlcs()100%210%
get_Peers()100%210%
OnModelCreating(...)100%210%

File(s)

/home/runner/work/NLightning/NLightning/src/NLightning.Infrastructure.Persistence/Contexts/NLightningDbContext.cs

#LineLine coverage
 1using Microsoft.EntityFrameworkCore;
 2
 3namespace NLightning.Infrastructure.Persistence.Contexts;
 4
 5using Entities.Bitcoin;
 6using Entities.Channel;
 7using Entities.Node;
 8using EntityConfiguration.Bitcoin;
 9using EntityConfiguration.Channel;
 10using EntityConfiguration.Node;
 11using Enums;
 12using Providers;
 13
 14public class NLightningDbContext : DbContext
 15{
 16    private readonly DatabaseType _databaseType;
 17
 18    public NLightningDbContext(DbContextOptions<NLightningDbContext> options, DatabaseTypeProvider databaseTypeProvider)
 019        : base(options)
 20    {
 021        _databaseType = databaseTypeProvider.DatabaseType;
 022    }
 23
 24    // Bitcoin DbSets
 025    public DbSet<BlockchainStateEntity> BlockchainStates { get; set; }
 026    public DbSet<WatchedTransactionEntity> WatchedTransactions { get; set; }
 027    public DbSet<WalletAddressEntity> WalletAddresses { get; set; }
 028    public DbSet<UtxoEntity> Utxos { get; set; }
 29
 30    // Channel DbSets
 031    public DbSet<ChannelEntity> Channels { get; set; }
 032    public DbSet<ChannelConfigEntity> ChannelConfigs { get; set; }
 033    public DbSet<ChannelKeySetEntity> ChannelKeySets { get; set; }
 034    public DbSet<HtlcEntity> Htlcs { get; set; }
 35
 36    // Node DbSets
 037    public DbSet<PeerEntity> Peers { get; set; }
 38
 39    protected override void OnModelCreating(ModelBuilder modelBuilder)
 40    {
 041        base.OnModelCreating(modelBuilder);
 42
 43        // Bitcoin entities
 044        modelBuilder.ConfigureBlockchainStateEntity(_databaseType);
 045        modelBuilder.ConfigureWatchedTransactionEntity(_databaseType);
 046        modelBuilder.ConfigureWalletAddressEntity(_databaseType);
 047        modelBuilder.ConfigureUtxoEntity(_databaseType);
 48
 49        // Channel entities
 050        modelBuilder.ConfigureChannelEntity(_databaseType);
 051        modelBuilder.ConfigureChannelConfigEntity(_databaseType);
 052        modelBuilder.ConfigureChannelKeySetEntity(_databaseType);
 053        modelBuilder.ConfigureHtlcEntity(_databaseType);
 54
 55        // Node entities
 056        modelBuilder.ConfigurePeerEntity(_databaseType);
 057    }
 58}