public static bool MakeUseOfIdentifyingCode(Guid identifyingCodeId) { if (identifyingCodeId == null || Guid.Empty.Equals(identifyingCodeId)) { return(false); } using (var context = new HotelDbContext()) { IIdentifyingCodeRepository repository = new IdentifyingCodeRepository(context); //改造方向:依赖注入,彻底去除对Infrastructure层的依赖 repository.MakeUseOfIdentifyingCode(identifyingCodeId); } return(true); }
public static bool MakeUseOfIdentifyingCode(Guid identifyingCodeId) { if (identifyingCodeId == null || Guid.Empty.Equals(identifyingCodeId)) { return false; } using (var context = new HotelDbContext()) { IIdentifyingCodeRepository repository = new IdentifyingCodeRepository(context); //改造方向:依赖注入,彻底去除对Infrastructure层的依赖 repository.MakeUseOfIdentifyingCode(identifyingCodeId); } return true; }