Revert "File scoped namespaces"

This reverts commit d31d8f574e.
This commit is contained in:
Burak Kaan Köse
2025-02-16 11:43:30 +01:00
parent d31d8f574e
commit cf9869b71e
617 changed files with 32097 additions and 31478 deletions

View File

@@ -6,58 +6,59 @@ using Wino.Core.Domain.Entities.Mail;
using Wino.Core.Domain.Entities.Shared;
using Wino.Core.Domain.Interfaces;
namespace Wino.Services;
public interface IDatabaseService : IInitializeAsync
namespace Wino.Services
{
SQLiteAsyncConnection Connection { get; }
}
public class DatabaseService : IDatabaseService
{
private const string DatabaseName = "Wino180.db";
private bool _isInitialized = false;
private readonly IApplicationConfiguration _folderConfiguration;
public SQLiteAsyncConnection Connection { get; private set; }
public DatabaseService(IApplicationConfiguration folderConfiguration)
public interface IDatabaseService : IInitializeAsync
{
_folderConfiguration = folderConfiguration;
SQLiteAsyncConnection Connection { get; }
}
public async Task InitializeAsync()
public class DatabaseService : IDatabaseService
{
if (_isInitialized)
return;
private const string DatabaseName = "Wino180.db";
var publisherCacheFolder = _folderConfiguration.PublisherSharedFolderPath;
var databaseFileName = Path.Combine(publisherCacheFolder, DatabaseName);
private bool _isInitialized = false;
private readonly IApplicationConfiguration _folderConfiguration;
Connection = new SQLiteAsyncConnection(databaseFileName);
public SQLiteAsyncConnection Connection { get; private set; }
await CreateTablesAsync();
public DatabaseService(IApplicationConfiguration folderConfiguration)
{
_folderConfiguration = folderConfiguration;
}
_isInitialized = true;
}
public async Task InitializeAsync()
{
if (_isInitialized)
return;
private async Task CreateTablesAsync()
{
await Connection.CreateTablesAsync(CreateFlags.None,
typeof(MailCopy),
typeof(MailItemFolder),
typeof(MailAccount),
typeof(AccountContact),
typeof(CustomServerInformation),
typeof(AccountSignature),
typeof(MergedInbox),
typeof(MailAccountPreferences),
typeof(MailAccountAlias),
typeof(AccountCalendar),
typeof(CalendarEventAttendee),
typeof(CalendarItem),
typeof(Reminder)
);
var publisherCacheFolder = _folderConfiguration.PublisherSharedFolderPath;
var databaseFileName = Path.Combine(publisherCacheFolder, DatabaseName);
Connection = new SQLiteAsyncConnection(databaseFileName);
await CreateTablesAsync();
_isInitialized = true;
}
private async Task CreateTablesAsync()
{
await Connection.CreateTablesAsync(CreateFlags.None,
typeof(MailCopy),
typeof(MailItemFolder),
typeof(MailAccount),
typeof(AccountContact),
typeof(CustomServerInformation),
typeof(AccountSignature),
typeof(MergedInbox),
typeof(MailAccountPreferences),
typeof(MailAccountAlias),
typeof(AccountCalendar),
typeof(CalendarEventAttendee),
typeof(CalendarItem),
typeof(Reminder)
);
}
}
}