beause the second dbcontext constructor ,delete this code
"public HisDbContext(string nameOrConnectionString) : base(nameOrConnectionString) { } public HisDbContext(DbConnection connection) : base(connection, true) { } "
I tried disable uow and use custom repository ,but my application throw exception ,not work correctly . this time ,I use sqlserver database and other database . 1.custom repository interface :
public interface IPacsRepository:IRepository<Register>
{
List<string> Patientinfo();
}
2.implement :
public class PacsRepository : PacsRepositoryBase<Register>,IPacsRepository
{
public PacsRepository(IDbContextProvider<PacsDbContext> dbContextProvider) : base(dbContextProvider)
{
}
public List<string> Patientinfo()
{
var query = GetAllList().Select(p => p.BrName).ToList();
return query;
}
}
3.called in service :
public class PacsAppService : ApplicationService,IPacsAppService
{
private readonly IPacsRepository _ppacsRepository; //custom repository
public PacsAppService(IPacsRepository ppacsRepository)
{
_ppacsRepository = ppacsRepository; //custom repository
}
[UnitOfWork(IsDisabled=true)]
public List<string> Patientinfo()
{
var register = _ppacsRepository.Patientinfo();
return register;
}
}
very very good~thanks hikalkan!
oh,some China network not upload picture to github, i will write a email to you for later.
Wish you happiness
Thanks for your reply