0
What is dependency injection.
I'm working on a project that uses C#, XAML, and entity framework (database first approach). Will it be good if I use dependency injection on it or not? I want to inject the Database Context on every form that I have but that seems impossible using XAML.
1 Odpowiedź
0
public class MyViewModel
{
private readonly MyDbContext _dbContext;
public MyViewModel(MyDbContext dbContext)
{
_dbContext = dbContext;
}
}