38 lines
1.3 KiB
C#
38 lines
1.3 KiB
C#
|
using System.Collections.Generic;
|
||
|
using System.Linq;
|
||
|
using bahnplan.web.database.Tables;
|
||
|
using LinqToDB;
|
||
|
using LinqToDB.Configuration;
|
||
|
|
||
|
namespace bahnplan.web.database {
|
||
|
public class Database {
|
||
|
public class ConnectionStringSettings : IConnectionStringSettings {
|
||
|
public string ConnectionString { get; set; }
|
||
|
public string Name { get; set; }
|
||
|
public string ProviderName { get; set; }
|
||
|
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 : LinqToDB.Data.DataConnection {
|
||
|
public DbConn() : base("db") { }
|
||
|
|
||
|
public ITable<User> Users => GetTable<User>();
|
||
|
public ITable<Leg> Legs => GetTable<Leg>();
|
||
|
public ITable<Ticket> Tickets => GetTable<Ticket>();
|
||
|
public ITable<TicketLeg> TicketLegs => GetTable<TicketLeg>();
|
||
|
public ITable<Trip> Trips => GetTable<Trip>();
|
||
|
public ITable<Card> Cards => GetTable<Card>();
|
||
|
}
|
||
|
}
|
||
|
}
|