forked from ddrilling/AsbCloudServer
AsbCloudDbContext Add active reference count prop
This commit is contained in:
parent
06fe0e09ff
commit
c6a1c4dae6
@ -60,20 +60,32 @@ namespace AsbCloudDb.Model
|
||||
public DbSet<WITS.Record50> Record50 => Set<WITS.Record50>();
|
||||
public DbSet<WITS.Record60> Record60 => Set<WITS.Record60>();
|
||||
public DbSet<WITS.Record61> Record61 => Set<WITS.Record61>();
|
||||
|
||||
|
||||
public int ReferenceCount { get; private set; }
|
||||
|
||||
public AsbCloudDbContext() : base()
|
||||
{
|
||||
ReferenceCount++;
|
||||
}
|
||||
|
||||
public AsbCloudDbContext(DbContextOptions<AsbCloudDbContext> options)
|
||||
: base(options)
|
||||
{
|
||||
ReferenceCount++;
|
||||
}
|
||||
|
||||
~AsbCloudDbContext()
|
||||
{
|
||||
ReferenceCount--;
|
||||
}
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
|
||||
if (!optionsBuilder.IsConfigured)
|
||||
optionsBuilder.UseNpgsql("Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True");
|
||||
optionsBuilder.UseNpgsql("Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True"
|
||||
//, builder=>builder.EnableRetryOnFailure(2, System.TimeSpan.FromMinutes(1))
|
||||
);
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
|
Loading…
Reference in New Issue
Block a user