using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using AyCode.Database.DbContexts; using AyCode.Utils.Extensions; namespace AyCode.Database; public class DalBase where TDbContext : DbContextBase { public string Name { get; private set; } private TDbContext _ctx; public TDbContext Ctx => _ctx; public DalBase() : this(Activator.CreateInstance()) { } public DalBase(TDbContext ctx) { _ctx = ctx; if (_ctx.Name.IsNullOrWhiteSpace()) _ctx.Name = _ctx.GetType().Name; Name = $"{this.GetType().Name}, {_ctx.Name}"; } public override string ToString() { return Name; } }