public SqlKataPortfolioRepositoryFixture() { _dbConnection = new SqliteConnection("Data Source=:memory:"); _dbConnection.Open(); var db = new SqlKataDatabase(_dbConnection, new SqliteCompiler()); this.PortfolioRepository = new(db); }
public SqlKataPortfolioEntryRepositoryFixture() { _dbConnection = new SqliteConnection("Data Source=:memory:"); _dbConnection.Open(); var db = new SqlKataDatabase(_dbConnection, new SqliteCompiler()); this.PortfolioRepository = new(db); this.PortfolioEntryRepository = new(db); DefaultPortfolioId = PortfolioRepository.Add(new("Foo", "Bar", Currency.Czk)); SecondaryPortfolioId = PortfolioRepository.Add(new("Bar", "Bar", Currency.Czk)); }
public SqlKataMarketOrderRepositoryFixture() { _dbConnection = new SqliteConnection("Data Source=:memory:"); _dbConnection.Open(); var db = new SqlKataDatabase(_dbConnection, new SqliteCompiler()); SqlKataPortfolioRepository portfolioRepository = new(db); SqlKataPortfolioEntryRepository portfolioEntryRepository = new(db); this.MarketOrderRepository = new(db); var defaultPortfolioId = portfolioRepository.Add(new("Foo", "Bar", Currency.Eur)); DefaultPortfolioEntryId = portfolioEntryRepository.Add(new("btc", defaultPortfolioId)); SecondaryPortfolioEntryId = portfolioEntryRepository.Add(new("ltc", defaultPortfolioId)); }
// This method gets called by the runtime. Use this method to add services to the container. // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 public void ConfigureServices(IServiceCollection services) { services.AddScoped <HttpClient>(); services.AddRazorPages(); services.AddServerSideBlazor(); services.AddMatBlazor(); services.AddMatToaster(config => { config.Position = MatToastPosition.BottomCenter; config.PreventDuplicates = true; config.NewestOnTop = true; config.ShowCloseButton = true; config.MaximumOpacity = 95; config.VisibleStateDuration = 3000; }); services.AddSingleton <ICryptoStatsSource, CoingeckoSource>(); // TODO ensure that SqlKataDatabase gets disposed var dbConnection = new SqliteConnection("Data Source=data.db"); var db = new SqlKataDatabase(dbConnection, new SqliteCompiler()); services.AddSingleton(ctx => db); services.AddSingleton <ICryptocurrencyResolver, CryptocurrencyResolverImpl>(); services.AddSingleton <ISummaryService, SummaryServiceImpl>(); services.AddSingleton <IPortfolioRepository, SqlKataPortfolioRepository>(); services.AddSingleton <IMarketOrderRepository, SqlKataMarketOrderRepository>(); services.AddSingleton <IPortfolioEntryRepository, SqlKataPortfolioEntryRepository>(); services.AddSingleton <IPortfolioService, PortfolioServiceImpl>(); services.AddSingleton <IMarketOrderService, MarketOrderServiceImpl>(); services.AddSingleton <IPortfolioEntryService, PortfolioEntryServiceImpl>(); }
/// <param name="db">Instance of the database object</param> /// <param name="tableName">Name of the table to be utilized</param> public SqlKataRepository(SqlKataDatabase db, string tableName) { Db = db; TableName = tableName; }
public SqlKataMarketOrderRepository(SqlKataDatabase db) : base(db, SqlSchema.TableMarketOrders) { }
public SqlKataPortfolioRepository(SqlKataDatabase db) : base(db, SqlSchema.TablePortfolios) { }