2022-11-20 03:06:41 +01:00
|
|
|
using LinqToDB;
|
|
|
|
using LinqToDB.Configuration;
|
|
|
|
using LinqToDB.Data;
|
2022-11-26 13:23:58 +01:00
|
|
|
using zotanpw.Backend.database.Tables;
|
2022-11-20 03:06:41 +01:00
|
|
|
|
2022-11-26 13:23:58 +01:00
|
|
|
namespace zotanpw.Backend.database;
|
2022-11-20 03:06:41 +01:00
|
|
|
|
|
|
|
public class Database {
|
|
|
|
private class ConnectionStringSettings : IConnectionStringSettings {
|
|
|
|
public string ConnectionString { get; set; } = null!;
|
|
|
|
public string Name { get; set; } = null!;
|
|
|
|
public string ProviderName { get; set; } = null!;
|
|
|
|
public bool IsGlobal => false;
|
|
|
|
}
|
|
|
|
|
|
|
|
public class Settings : ILinqToDBSettings {
|
|
|
|
public IEnumerable<IDataProviderSettings> DataProviders => Enumerable.Empty<IDataProviderSettings>();
|
|
|
|
|
|
|
|
public string DefaultConfiguration => "SQLite";
|
|
|
|
public string DefaultDataProvider => "SQLite";
|
|
|
|
|
|
|
|
public IEnumerable<IConnectionStringSettings> ConnectionStrings {
|
|
|
|
get { yield return new ConnectionStringSettings { Name = "db", ProviderName = "SQLite", ConnectionString = @"Data Source=database.db;" }; }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public class DbConn : DataConnection {
|
|
|
|
public DbConn() : base("db") { }
|
|
|
|
public ITable<DbInfo> DbInfo => this.GetTable<DbInfo>();
|
2022-11-20 17:00:51 +01:00
|
|
|
public ITable<TravelynxInfo> TravelynxInfo => this.GetTable<TravelynxInfo>();
|
2022-11-20 03:06:41 +01:00
|
|
|
public ITable<AlbumHistoryEntry> AlbumHistory => this.GetTable<AlbumHistoryEntry>();
|
|
|
|
public ITable<PlaylistHistoryEntry> PlaylistHistory => this.GetTable<PlaylistHistoryEntry>();
|
|
|
|
}
|
2022-11-20 17:00:51 +01:00
|
|
|
}
|