public void Dispose() { if (_Engine != null) { _Engine.Dispose(); _Engine = null; } }
/// <summary> /// Releases resources used by this instance. /// </summary> /// <remarks> /// This method ensures the AppDomain is unloaded and any template assemblies are unloaded with it. /// </remarks> /// <param name="disposing">Flag to determine whether the instance is being disposed explicitly.</param> protected virtual void Dispose(bool disposing) { if (disposing && !_disposed) { _proxy.Dispose(); AppDomain.Unload(_appDomain); _disposed = true; } }
private void Dispose(bool isDisposing) { if (!isDisposed) { if (isDisposing) { engine.Dispose(); } isDisposed = true; } }
public virtual string CreateEmail <T>(string templateName, T model) { try { var key = _service.GetKey(templateName); return(_service.RunCompile(key, typeof(T), model)); } finally { _service.Dispose(); } }
private bool disposedValue = false; // To detect redundant calls protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { if (_razor != null) { _razor.Dispose(); _razor = null; } } disposedValue = true; } }
/// <summary> /// Releases the unmanaged resources used by the <see cref="RazorEngine{TLanguage}"/> object and optionally releases the managed resources. /// </summary> /// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources.</param> protected virtual void Dispose(bool disposing) { if (!m_disposed) { try { if (disposing) { m_engineService?.Dispose(); } } finally { m_disposed = true; // Prevent duplicate dispose. } } }
protected virtual void Dispose(bool disposing) { if (!_disposed) { if (disposing) { if (_service != null) { _service.Dispose(); } if (_cache != null) { _cache.Dispose(); } } _disposed = true; } }
public void Dispose() { _origin.Dispose(); }
/// <summary> /// 初始话服务 /// </summary> public static void InitService() { service.Dispose(); service = RazorEngineService.Create(); }
/// <summary> /// Disposes of the underlying RazorEngine service /// </summary> public void Dispose() { _service.Dispose(); }
public void Dispose() { _razorEngineService?.Dispose(); }