Søren Bjerg Christensen Søren Bjerg Christensen - 11 months ago 92
ASP.NET (C#) Question

Converting from framework to core

I'm converting an existing web app from net framework to net core - but having a few troubles.

  1. How to replace usage of WebImage

  2. How to get CurrentCulture - used for Localization

Thanks in advance


Answer Source

If I understand you correctly, you only need a good DI framework. Then you can just use an existing one that has an integration with MVC. (ASP.NET Core has a built in DI, so it's easier to start with, but this does not mean you can't use DI in previous versions).

I would suggest that you use SimpleInjector. This is a great DI-container that is updated and maintained a lot and has an MVC integration in a separate Nuget package. It's also easy to use and the creator answers questions here on SO. You just need to install SimpleInjector and SimpleInjector.MVC and you can begin injecting in the constructor of your controllers.

P.S. If you need to use existing 3d party libraries in ASP.NET Core you might have troubles with this. It's not possible out of the box unless authors updated them and uploaded to Nuget. See this question e.g.