public void Dispose() { if (Impersonation != null) { Impersonation.ImpersonationEnd(); Impersonation = null; } }
public ImpersonationWrapper(bool isUsed, string domain, string creditId, string creditPwd) { // Impersonation을 사용할 경우만 값을 초기화 시켜준다. if (isUsed) { domain.ThrowIfNullOrWhiteSpace(nameof(domain)); creditId.ThrowIfNullOrWhiteSpace(nameof(creditId)); creditPwd.ThrowIfNullOrWhiteSpace(nameof(creditPwd)); Impersonation = new Impersonation(); Impersonation.ImpersonationStart(domain, creditId, creditPwd); } }