3

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

/Søren

  • 2
    I've tried this migration on a large Mvc application before and I have to tell you that those days weren't fun to say the least. If you want to save your nerves, my best suggestion is just don't do it. If something works, just let it do so. Keep the new stuff for startup projects. – Zoltán Tamási Oct 21 '16 at 19:45
  • 1
    I disagree that this question is too broad or is somehow requesting a full implementation. Questions regarding code do not always require code or code answers. This is addressing approaches in my opinion, and that does not require an actual implementation as an answer. – Travis J Oct 21 '16 at 19:48
  • `CutlureInfo.GetCurrentCulture` isn't available in .net core. See http://stackoverflow.com/questions/28202362/equivalent-of-cultureinfo-getcultureinfo –  Oct 21 '16 at 20:10
  • My main motivation for converting is to get access to dependency injection an thereby create a cleaner code. Have not been able to find good examples of that in mvc? (Java programmer normally :-) so have not spend much time i asp.net yet ) – Søren Bjerg Christensen Oct 22 '16 at 19:11
  • https://www.nuget.org/packages/System.Globalization/ for cultureinfo maybe – Henrik Bøgelund Lavstsen Oct 23 '16 at 07:06

2 Answers2

1

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.

Community
  • 1
  • 1
Ilya Chernomordik
  • 27,817
  • 27
  • 121
  • 207
0

Going to keep using MVC and combine it with framework Autofac