Abp添加DBContext
时间:2021-09-07 00:50:21
收藏:0
阅读:32
var controlSchedulesRepository = Abp.Dependency.IocManager.Instance.Resolve<Configuration.IAppConfigurationAccessor>();
var optionsBuilder = new DbContextOptionsBuilder<EvaluationSystemDbContext>();
optionsBuilder.UseSqlServer(controlSchedulesRepository.Configuration["ConnectionStrings:Default"]);
using (var context = new EvaluationSystemDbContext(optionsBuilder.Options))
{
var old = context.SchoolTerm.Where(x => x.Id == input.oldTermId&&x.TenantId==1&&x.IsDeleted==false).FirstOrDefault();
}
原文:https://www.cnblogs.com/zmldz/p/15232287.html
评论(0)