Clean Architecture in NET Framework 4.5 / 4.7.2 - c#

Is it possible to work with clean architecture in ASP.NET MVC 5 on the .NET Framework 4.5 and 4.7.2? I ask the question because I see more examples on .NET Core.
Thanks
I prefer known work clean architecture for .NET framework 4.7.2 for an ASP.NET MVC 5 project written in C#.

Related

Is it possible to run ASP .NET MVC 5 on the .NET Core platform?

Is it possible to run ASP .NET MVC 5 on the .NET Core platform, or at least reference .NET Core libraries from an ASP .NET MVC 5 application?
The reason I'm asking for this is that I have a ASP .NET MVC 5 application running on the .NET Framework, but I want to migrate the back end code to .NET Core, mainly because C# 8.0 is not going to be released for the .NET Framework, and I want to make use of C# 8 in the back end code.
You can't run your project ASP.NET MVC 5 in .NET Core.
You have to migrate your project to ASP.NET Core.
Microsoft has documented the process here : https://learn.microsoft.com/en-us/aspnet/core/migration/mvc?view=aspnetcore-3.0

Does Linux MONO support ASP.NET Core 2.2 MVC?

I'm not finding any clear answer on this. On the Compatibility page, they say:
Everything in .NET 4.7 except WPF, WWF, and with limited WCF and
limited ASP.NET async stack
What about .NET Core 2.2? Is it possible to run it on MONO or not?
I'm glad .NET Core framework is becoming more mature; but unfortunately it doesn't support legacy WebForms, and MONO's support for Core is unclear, so they don't mix well.
Mono 5.4 implements netstandard 2.0. Since ASP.NET Core 2.x runs on netstandard 2.0, Mono 5.4 also does support ASP.NET Core 2.x.
Note that starting with ASP.NET Core 3.0, the framework will only run on .NET Core. That means that if you want to stick to Mono, you will have to stick with ASP.NET Core 2.x.
Since ASP.NET Core 2.2 is not a long time support (LTS) release, which means that it will run out of support not too long after 3.0 releases, I would recommend you to stay on ASP.NET Core 2.1 if you want to run it on Mono.
That being said, there isn’t really a reason for you to run on Mono there. You can just use .NET Core properly. If you need Mono around for other WebForms projects, then you can just do that for those projects. But for ASP.NET Core, you can just choose the .NET Core runtime. Because in the end, ASP.NET Core and WebForms will not mix, even if you run both on Mono.

Can a .NET Core Web app consume .NET Framework class libraries?

I'm planning on migrating an old website built in WebForms to a .NET Core web application. But there are a few projects in the solution that are targeting .NET Framework 4.6.2 that are currently being used by the WebForm project. Is it possible to still uses these libraries in a .NET Core web app?
You should be able to if your .Net Core project is also targeting the net462 or later Full .NET Framework.

.net core app target .net framework 4.5.2 on Linux

I wanted to understand the dot net core support a bit more.
My basic understanding was that if I wanted to run a .net app on Linux then it needs to be built .net core and targeted netcoreapp1.0 framework to guarantee this.
1) I assume the above assumption is correct?
2) When I was reading various articles online, such as this one about referencing exiting .net framework project within a .net core application (https://www.hanselman.com/blog/HowToReferenceAnExistingNETFrameworkProjectInAnASPNETCore10WebApp.aspx)
If I did this, presumably the app would only run on Windows and not Linux?
3) In the following article:
https://blogs.msdn.microsoft.com/cesardelatorre/2016/06/28/running-net-core-apps-on-multiple-frameworks-and-what-the-target-framework-monikers-tfms-are-about/
In context to running with .net run 4.5.2 option (
dotnet run -f NET452), it's mentioned:
If this app were running on the .NET Core Platform, let’s say on a Linux box or a Mac, this code won’t be executed, but the app would
still be running on Linux or MacOS.
What's the distinction between running and not executing? If my initial understanding was correct, then by running with .net 4.5.2 option on Linux I wouldn't expect the app not to run at all.
Appreciate a few questions there but really wanted to understand .net core a bit more.
There is a difference between .NET Core and ASP.NET Core and the articles you mentioned are about running ASP.NET Core "apps" on .NET Framework. Let my try to clarify this using a few declarative statements:
.NET Core is the cross-platform runtime.
ASP.NET Core is a set of libraries that until version 1.1.* can run
on both .NET Framework and .NET Core.
This means you can create a .NET Framework application (=> e.g.
net452) and use ASP.NET Corein this application.
The CLI tooling works for both projects targeting netcoreapp* and
net* - but net* currently only works on windows.
This means that for netcoreapp1.*, you cannot reference arbitrary libraries that have been built for .NET Framework. If you change the target framework to say net452, you are no longer building a .net core application, but a .net framework application.
For ASP.NET Core 2.0 this is going to change. Again a few statements:
ASP.NET Core 2.0 is still a set of libraries but they can only be used on .NET Core 2.0 and not on .NET Framework
Do note that this is still under discussion at the time of writing: https://github.com/aspnet/Home/issues/2022
.NET Core 2.0 is able to freely reference libraries that have been built for .NET Framework up to version 4.6.1
However, some libraries may fail at run time if they try to use API methods that aren't available on .NET Core

ASP.NET Core 1.0 for enterprise applications

I am figuring out architectural components for my new web project. I am thinking to go with ASP.NET Core 1.0, EF7 stack. Some people suggest that ASP.NET Core 1.0 is in it's initial stage and it's not recommended to use it in enterprise web applications presently. Same opinions I heard in case of EF7 as well.
Mainly I want to know the disadvantages. Experts please explain the pros and cons of using ASP.NET Core 1.0 at present.
Somewhere they are true and somewhere they are wrong. ASP.NET Core is targeted by 2 frameworks .NET Core and .NET Framework. Both options are available in Visual Studio. You have to carefully choose, what is right for your project. Here are some differences\suggestions with ASP.NET Core and EF Core (EF 7 previously):
All .NET Framework Libraries (BCL or FCL) are not yet available for CoreFx (.NET Core library) but soon they will be available as the .NET team announced.
If your project uses .NET Framework libraries such as MailMessage and others, the use ASP.NET Core targeted with .NET Framework not .NET Core then you will be able to get all the features of .NET Framework in your ASP.NET Core application.
ASP.NET Core uses modern web work-flow for reducing page load times and for other attributes some of them are not available with the previous versions of ASP.NET.
EF Core 1.0 is new and cloud-optimized, it does not include (at least for now) featues which are available in EF 6.x such as Stored Procedures Mapping, Built-In feature for Seeding data and others.
If you want commercial projects that strongly rely on EF 6.x features which are not available now in EF Core, you can use ASP.NET Core 1.0 with .NET Framework with EF 6.x. I've a websites also created with ASP.NET Core with .NET Framework.
Here are some documentations for using ASP.NET Core 1.0 with EF 6.x and suggestions.

Categories