.NET framework or .NET Core for Web API for legacy SQL Server database - asp.net

I am working on my first .NET Web API. I have an existing .NET Windows Forms application using a SQL Server 2008 R2 database, and now I need to write a new app: a straightforward Android tablet application that will access the same database. These apps for just for internal use; not outside the one company.
I have been on a long journey though many tutorials, blogs and posts here, including this I'm lost. What happened to ASP.NET MVC 5? super helpful explanation of .net products and versions. But over and over I get hopelessly confused about which product I should choose to write the Web API. I can't always tell from some of the tutorials whether the ideas and techniques and configurations apply to both .NET Core and .NET Framework, or just one, and if the tutorial works with current versions. I am using Visual Studio 2019.
Does anyone have a recommendation for whether I should be using .NET Framework 4.8, or the new .NET Core?
I do not find this guidance from Microsoft helpful.
I think I should probably use Entity Framework to generate code from my existing database, but I also think I could pretty quickly code SQL calls right into the Web API controllers as I have seen done in some tutorials. Is that considered a bad practice?
Thank you for any steering you might offer.

Related

How to use SignalR real-time chart in ASP.Net WebForms

I want to use SignalR in my project for real time chart updates.
My project is developed in WebForms with VB.Net Language.
I searched for for 3,4 days but all I found were MVC examples. Can anyone suggest a solution?
Please notice me. Thank you
You can use SignalR with webforms, see this question for example :
Can SignalR be used with asp.net WebForms?
However, it will require to make your current webforms project evolve in several ways, which can be a loss of time and a risk if it's an old project hard to maintain.
An alternative could be to create a completely new web project for the backend with everything required for a clean support of SignalR server, and to consume it in JS (using jquery.signalr, etc) from your currently existing webforms pages on client side.
The ability to achieve this kind of thing will depend of what version of .Net and SignalR you could/must support.

Pipeline Development with ASP.NET

Microsoft offers Pipeline Development via its Extensibility framework where the application can consume External Addins. I have successfully developed an extensible application on a Windows Console Project.
Now I need to implement an extensible website which accepts Addins, I googled for days for guidelines to do so, unfortunately I couldn't find any resources.
So, my question: is it possible to do that ? if yes can you provide any resources to learn from ?
I found out that you can't use M.A.F with Asp.Net because the Grabdge Collection will be very ugly.
Instead if someone ever will counterpart this question, The answer is:
You will need to use M.E.F (Managed Extensibility Framework) which comes as part of .Net 4.0+

Do i need ASP.Net core if I have no plans to host my app anywhere other than IIS

I am going to start a ASP.Net project tomorrow.
ASP.Net with Web API, Angular 2 are in my plans, but I am concerned about .Net core as my project life time will be 3 years.
Here's my view of your situation if you do not have any future plans to migrate from Windows platform.
I do not have much experience with .Net Core, but I think .NET framework can offer much more than .NET core a this point. It's more tested, it's older which means it is probably more stable and not prone to changes as younger libraries.
Example for, Entity Framework Core is still missing some features which are offered in standard Entity Framework.
I'm not saying that this will not change, just trying to describe current situation.
For more detailed help, I guess you should post more information about your project.
The AspNetCoreModule has to be installed on your server and is part of the ASP.NET Core Server Hosting Bundle.
For detail information of installing and configuration. Please visit the following website.
https://weblog.west-wind.com/posts/2016/Jun/06/Publishing-and-Running-ASPNET-Core-Applications-with-IIS
Actually you can use ASP.NET Core with full .net framework. You're not obligated to use it in a combination with dotnet core.
In the end it depends on how much weight you give to the different arguments.
Generally speaking I vote for ASP.NET Core especially for a new project. You will never know how long the lifetime of the project will be (maybe the anticipated three years will be extended). I list some arguments that came to my mind - and some of them will gain or loose some weight over time.
Pros for ASP.NET Core
Faster. The ASP.NET Core Team and the community put much effort to make ASP.NET Core one of the fastest Web Frameworks. It is the first time I have heard that people are proud of some benchmarks.
New framework and in active development with a faster and more fine tuned release cycle. I expect new features to appear on ASP.NET Core faster then (if at all on classic ASP.NET).
Although Cross-Plattform is not necessary for you now - it will be easier for you to make the move (e.g. Linux) in the future.
Starting on Windows you can run you application on top off the full .net framework and use the magnitude of third party libraries.
Pros for ASP.NET (classic)
Robust - many years of experience in production
Feature complete (compared to ASP.NET Core, Entity Framework Core, .core)
Because of its lifetime you will find more people with indepth knowledge

Best practise to migrate Web Forms to ASP.NET Core MVC

I am trying to migrate a project from classic ASP.Net Web Forms to ASP.NET MVC.
While I have read through http://www.codeproject.com/Articles/38778/ASP-NET-WebForms-and-ASP-NET-MVC-in-Harmony. I have a basic idea on how the code structure, libraries and routing should be done.
For your information, the scope of my existing project is around 400 pages and 300 tables.
On top of my head I have two approaches:
Start from stretch, rewriting the whole system - Obviously this would require intensive work and take a long time. Any change made on existing system would need a duplicate change made to the new system.
Migrate the page one each - I still have a rebuild the entire core library (for accessing db), and get the page migrated one by one. For this I would assume to have two core libraries (new and old) running simultaneously with different pages connect to one of those.
Would anyone have similar experience and advise a proper way to start?
For this complete revamp I may also target at the latest technology - .NET Core and MVC6, by taking these would I have extra advantage, or some blockages I would have to take care of?
Any suggestion and opinions are appreciated. Cheers.
Microsoft is a bit hush hush on the subject but the WebForms engine is probably never going to make its way to ASP.NET Core. One might think that MS is waiting to see if the community is calling for a port, but I think they're trying to kill it discretely (not like Silverlight).
Why? Because it proved to be a bad good idea on the long run, easy to use at first, but extremely complex to master (because of viewstate and page lifecycle), with a tendency to allow average developers to build very tedious application (in french we say steam factories). Also it was very poorly adapted to modern web development (Ajax, unit testing, IoC). They tried to fix it with a couple of tweaks, but the overall architecture is just not adapted to this kind of things. MVC is a treat in comparison!
To answer your question, it's not really possible to migrate WebForms to MVC, because those are quite different architectures, and of course the architecture is what an application sits on top on, so if you change it, you might as well rewrite it from scratch.
What can help you a lot is if your app is divided in tiers (business, data access, UI). If it's not the case, you could start by doing this, properly separating the UI project from the rest. Then you would just have to rewrite the ASP.NET project and not the rest.
There are some useful resources I'd like to share with the StackOverflow community just in case you are having troubles to decide what to do:
modernization of your existing Web Forms app
migration to MVC or Core
or whether to start a new project on Web Forms, MVC and Core.
Here you go:
https://www.telerik.com/blogs/review-of-telerik-toolsets-for-aspnet-web-forms-core
Modernizing ASP.NET Web Forms Applications by Tomáš Herceg (Microsoft MVP ) - https://tomasherceg.com/blog/post/modernizing-asp-net-web-forms-applications-part-1
Migrating Old ASP.NET Applications to .NET Core by Edi Wang (Microsoft MVP) - https://edi.wang/post/2018/10/31/migrating-old-aspnet-applications-to-net-core
Choose between ASP.NET and ASP.NET Core (Microsoft docs) - https://learn.microsoft.com/en-us/aspnet/core/fundamentals/choose-aspnet-framework?view=aspnetcore-3.1
Migrate from ASP.NET to ASP.NET Core (Microsoft docs) - https://learn.microsoft.com/en-us/aspnet/core/migration/proper-to-2x/?view=aspnetcore-3.1
i have come across below links
https://www.youtube.com/watch?v=CZuqMrWSano
https://www.dotvvm.com/blog/59/Modernizing-ASP-NET-Web-Forms-applications-with-DotVVM
DotVVM package helps us to migrate ASP.Net Web Forms migration to ASP.NET Core without re-writting completely.
i have not tried any production application. still have tried some sample pages. you can try this out.
I can agree that for many cases a re-write of an ASP.NET application where WebForms is used widely may do not provide any business value.
Therefore we decided to use our experience with ASP NET WebForms to develop a highly compatible port of WebForms for ASP NET Core / .NET 6.0.
We use the solution in our own ASP NET WebForms-based products and projects as well as a licensable component library.
So the Forms can still be used and you can focus on the .NET CORE/6 migration.

Restful Service in ASP.NET

Apart from using ADO.NET Data Services or WCF Services,When i want to use RESTful services in ASP.NET (consider if i want to use it ASP.NET 2.0), do i need to download any specific API inorder to use Rest Webservice.If so,where can i download the same?
If there is any possible way to upgrade to .NET 3.5, then I highly recommend that you do that and use ASP.NET MVC. It's built to handle a good number of things you would have to build from the ground up (the most important being path mapping) and it will save you a tremendous amount of time.
While it could be done in ASP.NET in .NET 2.0, it just isn't practical given the amount of work involved and the fact that it's already done for you in a later version of the framework.
Visual Studio magazine did a decent article on how this could be accomplished in native ASP.NET 2.0.
I read over it briefly a while ago and it was a good overview of how you could do it without any external dependencies.

Resources