InkForge/app/InkForge.Desktop/Models/Workspace.cs
2024-05-02 21:44:13 +02:00

31 lines
604 B
C#

using InkForge.Desktop.Data.Options;
using Microsoft.Extensions.DependencyInjection;
namespace InkForge.Desktop.Models;
public sealed class Workspace(IServiceScope scope) : IDisposable
{
private bool _disposedValue;
private IServiceScope? _scope = scope;
public string Name { get; set; } = default!;
public LocalWorkspaceOptions Options { get; set; } = default!;
public IServiceProvider Services { get; } = scope.ServiceProvider;
public void Dispose()
{
if (!_disposedValue)
{
if (_scope is { })
{
_scope.Dispose();
_scope = null;
}
_disposedValue = true;
}
}
}