我想获取所有过程代码,但在 coun() 工作正常时出现错误“方法 'all' 没有重载需要 0 个参数”
private static void Processor()
{
IUnitOfWorkManager _unitOfWorkManager = IocManager.Instance.Resolve<IUnitOfWorkManager>();
IDbPerTenantConnectionStringResolver _connectionStringResolver = IocManager.Instance.Resolve<IDbPerTenantConnectionStringResolver>(); ;
IDbContextResolver _dbContextResolver = IocManager.Instance.Resolve<IDbContextResolver>();
var srcConnectionString = "Server=NABIIL\\SQLEXPRESS; Database=db-qa; Trusted_Connection=True;"; //ConnectionStringHelper.GetConnectionString("Default");
var targetConnectionString = "Server=NABIIL\\SQLEXPRESS; Database=db-Migrated; Trusted_Connection=True;"; //ConnectionStringHelper.GetConnectionString("Target");
DbContext srcContext, targetContext;
Debugger.Break();
var procedureCode = "";
using (srcContext= _dbContextResolver.Resolve<DbContext>(srcConnectionString, null))
{
//var items = srcContext.Patients.Count();
procedureCode = srcContext.ProcedureCodes.All();
Debugger.Break();
//_unitOfWorkManager.Current.SaveChanges();
}
using (targetContext = _dbContextResolver.Resolve<DbContext>(targetConnectionString, null))
{
Debugger.Break();
//var items = targetContext.Patients.Count();
targetContext.Patients.add(procedureCode);
//_unitOfWorkManager.Current.SaveChanges();
}
}