30 lines
512 B
C#
30 lines
512 B
C#
using SqlSugar;
|
|
|
|
namespace AssetManager.Data;
|
|
|
|
public class DatabaseService
|
|
{
|
|
private readonly ISqlSugarClient _db;
|
|
|
|
public DatabaseService(ISqlSugarClient db)
|
|
{
|
|
_db = db;
|
|
}
|
|
|
|
public void InitializeDatabase()
|
|
{
|
|
_db.CodeFirst.InitTables(
|
|
typeof(User),
|
|
typeof(Strategy),
|
|
typeof(Portfolio),
|
|
typeof(Position),
|
|
typeof(Transaction)
|
|
);
|
|
}
|
|
|
|
public ISqlSugarClient GetDb()
|
|
{
|
|
return _db;
|
|
}
|
|
}
|