A full stack WPF MVVM trading application.
Follow along at https://www.youtube.com/playlist?list=PLA8ZIAm2I03jSfo18F7Y65XusYzDusYu5
A full stack WPF MVVM trading application.
A full stack WPF MVVM trading application.
Follow along at https://www.youtube.com/playlist?list=PLA8ZIAm2I03jSfo18F7Y65XusYzDusYu5
Hi Sean,
First, as a newbie to WPF, thank you so much for doing your series and tutorials. They have been quite invaluable over the past couple of months. Using your application as a template has been wonderful, but I had two questions surrounding the dependency injection process.
The services registered with dependency injection are only constructed when the application needs them (i.e. switching to a view or viewmodel for the first time). Is there a preferred method for loading specific services ahead of time so that any required (and time-consuming) startup processes for those services might be loaded ahead of time?
I have services that need to do cleanup, and so they inherit from IDisposable. I noticed those services that were loaded with dependency injection are not being disposed when the application closes. The ServiceProvider implementation itself also inherits from IDisposable, but is not being called (since the service provider only exists in the OnStartup method of the App (and not in some type of "using" statement). What is the preferred way to dispose of the service provider or any services registered within the service provider so that proper cleanup can occur?
Thanks for your help!
-Jason
Greetings,
This tutorial has been awesome, I have created my own using your tutorial geared more towards the crypto markets.
Instead of a custom APIHttpClient, I am attempting to inject a "CoinbaseProClient" from the CoinbasePro-Csharp library.
This "works" for the intial loading of the MajorIndexViewModel but only for first card. secondary, and 3rd cards are not loading.
How can inject this client instead of the "FinancialModelAPIHttpClient" when utilizing the "AddFinancialModelingAPIHostBuilderExtension" ?
-Or Rather-
What is preventing the current setup from running the GetTicker() command for the other two indexes?
There are no errors when debugging, the 2nd and 3rd "Tasks" in MajorIndexViewModel.LoadMajorIndexes() but tasks do not run/update values on "Cards".
Example Gist - AddFinancialModelingAPIHostBuilderExtension.cs
Example Gist - MajorIndexService.cs
Example Gist - CoinBaseProAPIHttpClient.cs
Example Gist - MajorIndexViewModel.cs
**Note I am only calling 3 "indexes" from list of types (BtcUsd, LtcUsd, EthUsd) from CoinbasePro library.
Hi guys !!! Why doesn't works when singleton or scoped scope are used ?
var connectionString = "server=localhost\\sqlexpress;initial catalog=db_sgone_desktop;user id=sa;password=123456;"; services.AddDbContext<ErpDbContext>(opt => opt.UseSqlServer(connectionString)); services.AddSingleton<ErpDbContext>(); services.AddSingleton<IVersaoSistemaRepository, VersaoSistemaRepository>(); services.AddSingleton<IVersionamentoRepository, VersionamentoRepository>();
now, I write the command
add-migration initial, and after update-database
I get the following error:
An error occurred while accessing the Microsoft.Extensions.Hosting services. Continuing without the application service provider. Error: Some services are not able to be constructed (Error while validating the service descriptor 'ServiceType: Dsbr.Source.Domain.Interfaces.Repositories.INumeroNotaSerieRepository Lifetime: Singleton ImplementationType: Dsbr.Source.Infra.Repositories.NumeroNotaSerieRepository': Cannot consume scoped service 'Microsoft.EntityFrameworkCore.DbContextOptions`1[Dsbr.Source.Infra.EF.Context.ErpDbContext]' from singleton 'Dsbr.Source.Domain.Interfaces.Repositories.INumeroNotaSerieRepository'.)
Therefore, when i change the scope to services.AddTransient it works fine ...
AccountDataService could inherit from NonQueryDataService thereby removing the need to write out or have to explicitly delegate functionality to NonQueryDataService... here's what I mean:
public class AccountDataService : NonQueryDataService<Account>, IDataService<Account>
{
private readonly SimpleTraderDbContextFactory _contextFactory;
public AccountDataService(SimpleTraderDbContextFactory contextFactory) : base(contextFactory)
{
_contextFactory = contextFactory;
}
public async Task<IEnumerable<Account>> GetAll()
{
await using var context = _contextFactory.CreateDbContext(new[] {""});
var list = await context.Accounts.Include(x => x.AssetTransactions).Include(x => x.AccountHolder)
.ToListAsync();
return list;
}
public async Task<Account> Get(int id)
{
await using var context = _contextFactory.CreateDbContext(new[] {""});
var entity = await context.Accounts.Include(x => x.AssetTransactions).Include(x => x.AccountHolder)
.FirstOrDefaultAsync(x => x.Id == id);
return entity;
}
}
Hi Sean,
I'm very impressed of what you're doing and about the ease, you're creating the app. This shows up the huge gap between a youngster and me...
However, I be using your SimpleTrader as a template to a) learn to switch from VB to C# since there is much more information around about the latter; and b) creating my own solution to administrate tenancy, which is here in Germany quite a complex task. However I would prefer to have a connection to my personal Card-DAV instead of creating and maintaining user data within the app.
As you were asking for suggestions and as you stated, you like complex challenges, I dare to ask you if you could fancy creating a base for a Card-DAV (Web-DAV) interface in your trader?
Best regards,
Gerald
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.