Skip to content

a quick demonstration for using dependency injection in .net framework winforms application with mvp pattern.

Notifications You must be signed in to change notification settings

theilgaz/winforms-dependency-injection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WinForms Dependency Injection Sample

A quick demonstration for using Dependency Injection in .NET Framework 4.7 WinForms Application with MVP Pattern.

Dependencies

Package Name Version
Microsoft.Extensions.DependencyInjection 5.0.1

Screenshots

Program.cs

You should register your services in ConfigureServices() method. The Service Provider property should be in Program.cs too. Method named GetService is just added for handling your service object easier.

Output


Presenter Layer

As I mentioned before, we are going to use GetService method from Program.cs to call our service objects here.

Output


View Layer

Now we are calling method from presenter like we do.

Output


Sample Service

Output


Output

In this sample, executing UI method from UserView which calls from UserPresenter that references IUserService which is the origin reference of method implemented in UserService.

Output

About

a quick demonstration for using dependency injection in .net framework winforms application with mvp pattern.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages