public static IList <IdentifyingCodeDetailSearchDTO> GetIdentifyingCodeDetailById(Guid identifyingCodeId, string moduleName) { if (Guid.Empty.Equals(identifyingCodeId) || string.IsNullOrEmpty(moduleName)) { return(null); } var identifyingCode = new IdentifyingCodeInfo() { IdentifyingCodeId = identifyingCodeId, ModuleName = moduleName }; using (var context = new HotelDbContext()) { IIdentifyingCodeRepository repository = new IdentifyingCodeRepository(context); //改造方向:依赖注入,彻底去除对Infrastructure层的依赖 return(repository.GetIdentifyingCodeDetailById(identifyingCode)); } }
public static IList<IdentifyingCodeDetailSearchDTO> GetIdentifyingCodeDetailById(Guid identifyingCodeId, string moduleName) { if (Guid.Empty.Equals(identifyingCodeId) || string.IsNullOrEmpty(moduleName)) { return null; } var identifyingCode = new IdentifyingCodeInfo() { IdentifyingCodeId = identifyingCodeId, ModuleName = moduleName }; using (var context = new HotelDbContext()) { IIdentifyingCodeRepository repository = new IdentifyingCodeRepository(context); //改造方向:依赖注入,彻底去除对Infrastructure层的依赖 return repository.GetIdentifyingCodeDetailById(identifyingCode); } }