Resolved How can I use Entity Framework Core in Windows Forms Apps?

Mazen

New member
Joined
Dec 12, 2020
Messages
4
Programming Experience
1-3
Hi,
I have been searching for an easy to follow tutorial with no success. May I know if it is possible to use EF Core in WinForms app?

Thank you in advance you for your help,
 
Solution
It is possible to use EF Core in .NET Core apps. If you create an app targeting .NET Core and you use EF, you will use EF Core. WinForms was supported in .NET 3.x with C# but not fully. .NET 5 has full support for WinForms so if you create a Windows Forms Application project targeting .NET Core 3.x or .NET 5 then you can use EF Core. Using EF Core is the same no matter the application type. All that differs is how you display the data.
It is possible to use EF Core in .NET Core apps. If you create an app targeting .NET Core and you use EF, you will use EF Core. WinForms was supported in .NET 3.x with C# but not fully. .NET 5 has full support for WinForms so if you create a Windows Forms Application project targeting .NET Core 3.x or .NET 5 then you can use EF Core. Using EF Core is the same no matter the application type. All that differs is how you display the data.
 
Solution
... and how you store the connection strings...
 
It is possible to use EF Core in .NET Core apps. If you create an app targeting .NET Core and you use EF, you will use EF Core. WinForms was supported in .NET 3.x with C# but not fully. .NET 5 has full support for WinForms so if you create a Windows Forms Application project targeting .NET Core 3.x or .NET 5 then you can use EF Core. Using EF Core is the same no matter the application type. All that differs is how you display the data.
many thanks @jmcilhinney it is cristal clear.
 
Yes, that is the .NET Core approach. Now, see how well that works with standard .NET Framework instead of .NET Core.

As a quick reminder, the best practice is not to hard code your settings into the code, but rather put the settings into a settings file like the appsettings.json, app.config, or web.config file. This is where things break down between .NET Framework and .NET Core -- how those settings are stored and how you get to them.
 
Last edited:
Yes, that is the .NET Core approach. Now, see how well that works with standard .NET Framework instead of .NET Core.

As a quick reminder, the best practice is not to hard code your settings into the code, but rather put the settings into a settings file like the appsettings.json, app.config, or web.config file. This is where things break down between .NET Framework and .NET Core -- how those settings are stored and how you get to them.
Thank you @Skydiver it is well understood
 
Back
Top Bottom