This commit is contained in:
Jöran Malek 2024-04-05 12:31:34 +02:00
parent 4c2b5cca93
commit 43b4d50e43
28 changed files with 674 additions and 249 deletions

View file

@ -1,14 +1,11 @@
using InkForge.Data;
using InkForge.Desktop.Data.Options;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
namespace InkForge.Desktop.Models;
public sealed class Workspace : IDisposable
{
private readonly IDbContextFactory<NoteDbContext> _dbContextFactory;
private bool _disposedValue;
private IServiceScope? _scope;
@ -21,20 +18,9 @@ public sealed class Workspace : IDisposable
public Workspace(IServiceScope scope)
{
_scope = scope;
_dbContextFactory = Services.GetRequiredService<IDbContextFactory<NoteDbContext>>();
}
// public Note AddNote(Note? parent)
// {
// }
public void Dispose()
{
Dispose(disposing: true);
GC.SuppressFinalize(this);
}
private void Dispose(bool disposing)
{
if (!_disposedValue)
{
@ -47,4 +33,14 @@ public sealed class Workspace : IDisposable
_disposedValue = true;
}
}
// private async Task LoadNotes()
// {
// await using var dbContext = await _dbContextFactory.CreateDbContextAsync().ConfigureAwait(false);
// await foreach (var asdf in dbContext.Notes.AsAsyncEnumerable().ConfigureAwait(false))
// {
// }
// _ = (await dbContext.Notes.ToListAsync().ConfigureAwait(false));
// }
}